step 3 : buat loop kode call api
This commit is contained in:
31
build/lib_052_master.js
Normal file
31
build/lib_052_master.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rpt_052_000 = void 0;
|
||||
const axios_1 = __importDefault(require("axios"));
|
||||
const config_1 = __importDefault(require("./config/config"));
|
||||
const logging_1 = __importDefault(require("./config/logging"));
|
||||
const server_1 = require("./server");
|
||||
const rpt_052_000 = async (kode, date, target) => {
|
||||
// etl/Tat/proses_etl/000/2021-06-12/0
|
||||
const url_tat = config_1.default.base_url + "etl/Tat/proses_etl/" + kode + "/" + date + "/" + target;
|
||||
logging_1.default.info(server_1.NAME_SPACE, "Info : " + url_tat);
|
||||
try {
|
||||
const resp = await axios_1.default.get(url_tat, {
|
||||
responseType: "arraybuffer",
|
||||
});
|
||||
const jresp = JSON.parse(resp.data.toString());
|
||||
return jresp;
|
||||
}
|
||||
catch (e) {
|
||||
if (axios_1.default.isAxiosError(e)) {
|
||||
logging_1.default.error(server_1.NAME_SPACE, e.response?.data.toString());
|
||||
}
|
||||
else if (e instanceof Error) {
|
||||
logging_1.default.error(server_1.NAME_SPACE, e.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.rpt_052_000 = rpt_052_000;
|
||||
Reference in New Issue
Block a user