ajuste na funcao de node_fetch
This commit is contained in:
parent
059780f4c4
commit
84e3b9d377
4 changed files with 37 additions and 30 deletions
|
|
@ -48,26 +48,35 @@ var usuarios_quipo_vincular = function (_a) {
|
|||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url, headers, parametros;
|
||||
return __generator(this, function (_b) {
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/vinculos__criar");
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
token: token_produto,
|
||||
};
|
||||
parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario: codigo_usuario, vinculo: vinculo },
|
||||
email: email,
|
||||
};
|
||||
return [2 /*return*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST",
|
||||
})
|
||||
.then(function (r) { return String(r); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao criar vinculo de usuario ".concat(e.message));
|
||||
})
|
||||
.then(function (r) { return r; })];
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
url = "".concat((0, _urlAutenticacao_1.urlAutenticacao)(ambiente), "/api/vinculos__criar");
|
||||
if (!token_produto)
|
||||
return [2 /*return*/, p_respostas_1.respostaComuns.erro("token_produto não informado")];
|
||||
headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario: codigo_usuario, vinculo: vinculo },
|
||||
email: email,
|
||||
};
|
||||
return [4 /*yield*/, (0, cross_fetch_1.default)(url, {
|
||||
headers: headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST",
|
||||
})
|
||||
.then(function (r) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, r.json()];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
}); }); })
|
||||
.catch(function (e) {
|
||||
return p_respostas_1.respostaComuns.erro("Erro ao criar vinculo de usuario ".concat(e.message));
|
||||
})];
|
||||
case 1: return [2 /*return*/, _b.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue