This commit is contained in:
Luiz H. R. Silva 2024-06-19 17:47:48 -03:00
parent a6205f1ab6
commit e580643abc
40 changed files with 329 additions and 507 deletions

View file

@ -35,12 +35,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.codigoContaSite = void 0;
var p_respostas_1 = require("p-respostas");
var _urlAutenticacao_1 = require("./_urlAutenticacao");
var cross_fetch_1 = __importDefault(require("cross-fetch"));
var codigoContaSite = function (_a) {
var ambiente = _a.ambiente, post = _a.post, buscar = _a.buscar;
var ambiente = _a.ambiente, post = _a.post;
return __awaiter(void 0, void 0, void 0, function () {
var url, resp, e_1;
return __generator(this, function (_b) {
@ -50,9 +54,16 @@ var codigoContaSite = function (_a) {
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, buscar(url, post).catch(function (e) {
return p_respostas_1.respostaComuns.erro("erro ao buscar c\u00F3digo do site: ".concat(e));
})];
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
method: "POST",
body: JSON.stringify(post),
headers: { "Content-Type": "application/json" },
})
.then(function (r) { return r.json(); })
.catch(function (e) {
return p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]);
})
.then(function (r) { return r; })];
case 2:
resp = _b.sent();
return [2 /*return*/, resp];