first commit
This commit is contained in:
23
source/lib_order.ts
Normal file
23
source/lib_order.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import axios from "axios";
|
||||
import config from "./config/config";
|
||||
import logging from "./config/logging";
|
||||
import { NAME_SPACE } from "./server";
|
||||
|
||||
export const get_order = async (row_per_batch: number) => {
|
||||
const url_patient =
|
||||
config.base_url + "/etl/getorder/getdata?limit=" + row_per_batch;
|
||||
logging.info(NAME_SPACE, "Info : " + url_patient);
|
||||
try {
|
||||
const resp = await axios.get(url_patient, {
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user