feat: jurnal JPA dokter
This commit is contained in:
46
source/lib_jurnaljpad.ts
Normal file
46
source/lib_jurnaljpad.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import axios from "axios";
|
||||
import config from "./config/config";
|
||||
import logging from "./config/logging";
|
||||
import { NAME_SPACE } from "./server";
|
||||
|
||||
export const getJurnalJPAD = async (
|
||||
startDate: string = "",
|
||||
endDate: string = ""
|
||||
) => {
|
||||
const url = `${config.base_url}mockup/accounting/injectjurnaljpadokter/getJurnal/${startDate}/${endDate}`;
|
||||
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 injectJurnalJPAD = async (prm: any) => {
|
||||
const url = `${config.base_url}mockup/accounting/injectjurnaljpadokter/inject`;
|
||||
logging.info(NAME_SPACE, `\t INFO : ${url}`);
|
||||
|
||||
try {
|
||||
const resp = await axios.post(url, prm, {
|
||||
headers: { "Content-Type": "application/json; charset=UTF-8" },
|
||||
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