fixing placeholder in payouts
This commit is contained in:
parent
6ffc3942ad
commit
3bbc644dcb
@ -1,28 +1,37 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { serializeError } from "serialize-error";
|
import { serializeError } from "serialize-error";
|
||||||
|
|
||||||
|
|
||||||
function defaultResponseProcessor(response, dataProcessor) {
|
function defaultResponseProcessor(response, dataProcessor) {
|
||||||
return {error: false, data: dataProcessor(response.data), status: response.status};
|
return {
|
||||||
|
error: false,
|
||||||
|
data: dataProcessor(response.data),
|
||||||
|
status: response.status,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
function defaultErrorProcessor(error) {
|
function defaultErrorProcessor(error) {
|
||||||
return {error: true, data: serializeError(error), status: (error.code === "ERR_NETWORK" ? 502:serializeError(error).status)};
|
return {
|
||||||
|
error: true,
|
||||||
|
data: serializeError(error),
|
||||||
|
status: error.code === "ERR_NETWORK" ? 502 : serializeError(error).status,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
function defaultDataResponseProcessor(data) {
|
function defaultDataResponseProcessor(data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const API_PATH_MAIN = "https://hostapay.trade/api/v1/";
|
export const API_PATH_MAIN = "https://hostapay.trade/api/v1/";
|
||||||
export const API_PATH_TEST = "https://test.0x000f.ru/api/v1/";
|
export const API_PATH_TEST = "https://test.0x000f.ru/api/v1/";
|
||||||
|
|
||||||
let BasicURLValue = API_PATH_MAIN;
|
let BasicURLValue = API_PATH_MAIN;
|
||||||
|
|
||||||
async function makePost(url, data, options = undefined,
|
async function makePost(
|
||||||
|
url,
|
||||||
|
data,
|
||||||
|
options = undefined,
|
||||||
responseProcessor = defaultResponseProcessor,
|
responseProcessor = defaultResponseProcessor,
|
||||||
dataResponseProcessor = defaultDataResponseProcessor,
|
dataResponseProcessor = defaultDataResponseProcessor,
|
||||||
errorProcessor = defaultErrorProcessor)
|
errorProcessor = defaultErrorProcessor
|
||||||
{
|
) {
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(BasicURLValue + url, data, options);
|
const res = await axios.post(BasicURLValue + url, data, options);
|
||||||
return responseProcessor(res, dataResponseProcessor);
|
return responseProcessor(res, dataResponseProcessor);
|
||||||
@ -31,11 +40,13 @@ async function makePost(url, data, options = undefined,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function makeGet(url, options = undefined,
|
async function makeGet(
|
||||||
|
url,
|
||||||
|
options = undefined,
|
||||||
responseProcessor = defaultResponseProcessor,
|
responseProcessor = defaultResponseProcessor,
|
||||||
dataResponseProcessor = defaultDataResponseProcessor,
|
dataResponseProcessor = defaultDataResponseProcessor,
|
||||||
errorProcessor = defaultErrorProcessor)
|
errorProcessor = defaultErrorProcessor
|
||||||
{
|
) {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get(BasicURLValue + url, options);
|
const res = await axios.get(BasicURLValue + url, options);
|
||||||
return responseProcessor(res, dataResponseProcessor);
|
return responseProcessor(res, dataResponseProcessor);
|
||||||
@ -44,4 +55,11 @@ async function makeGet(url, options = undefined,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export {BasicURLValue, makePost, makeGet, defaultResponseProcessor, defaultDataResponseProcessor, defaultErrorProcessor};
|
export {
|
||||||
|
BasicURLValue,
|
||||||
|
makePost,
|
||||||
|
makeGet,
|
||||||
|
defaultResponseProcessor,
|
||||||
|
defaultDataResponseProcessor,
|
||||||
|
defaultErrorProcessor,
|
||||||
|
};
|
||||||
|
@ -667,7 +667,7 @@
|
|||||||
<input
|
<input
|
||||||
bind:value={newPayoutTraderUUID}
|
bind:value={newPayoutTraderUUID}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="ID"
|
placeholder="1a02045f-c681-4d05-84aa-18e8a351daa7"
|
||||||
class="input input-bordered w-full max-w-xs"
|
class="input input-bordered w-full max-w-xs"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user