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