57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import axios from "axios";
|
|
import config from "./config/config";
|
|
import logging from "./config/logging";
|
|
import { NAME_SPACE } from "./server";
|
|
|
|
export const getOrder = async () => {
|
|
const url = config.base_url + "tools/member/cashbackpoint/list/";
|
|
logging.info(NAME_SPACE, "\t INFO : " + url);
|
|
try {
|
|
const resp = await axios.get(url, {
|
|
responseType: "arraybuffer",
|
|
});
|
|
const jresp = JSON.parse(resp.data.toString());
|
|
return jresp;
|
|
} catch (e) {
|
|
if (axios.isAxiosError(e)) {
|
|
logging.error(NAME_SPACE, e.response?.data.toString());
|
|
} else if (e instanceof Error) {
|
|
logging.error(NAME_SPACE, e.message);
|
|
}
|
|
}
|
|
};
|
|
export const updateCashback = async (id: string) => {
|
|
const url = config.base_url + "tools/member/cashbackpoint/getcashback/" + id;
|
|
logging.info(NAME_SPACE, "\t INFO : " + url);
|
|
try {
|
|
const resp = await axios.get(url, {
|
|
responseType: "arraybuffer",
|
|
});
|
|
const jresp = JSON.parse(resp.data.toString());
|
|
return jresp;
|
|
} catch (e) {
|
|
if (axios.isAxiosError(e)) {
|
|
logging.error(NAME_SPACE, e.response?.data.toString());
|
|
} else if (e instanceof Error) {
|
|
logging.error(NAME_SPACE, e.message);
|
|
}
|
|
}
|
|
};
|
|
export const uploadCashback = async () => {
|
|
const url = config.base_url + "tools/member/uploadpoint/upload/";
|
|
logging.info(NAME_SPACE, "\t INFO : " + url);
|
|
try {
|
|
const resp = await axios.get(url, {
|
|
responseType: "arraybuffer",
|
|
});
|
|
const jresp = JSON.parse(resp.data.toString());
|
|
return jresp;
|
|
} catch (e) {
|
|
if (axios.isAxiosError(e)) {
|
|
logging.error(NAME_SPACE, e.response?.data.toString());
|
|
} else if (e instanceof Error) {
|
|
logging.error(NAME_SPACE, e.message);
|
|
}
|
|
}
|
|
};
|