funcao para criar vinculo de usuario
This commit is contained in:
parent
78acaa0816
commit
b5360ab1a9
9 changed files with 360 additions and 216 deletions
32
dist-import/autenticacao/_usuarios_quipo_vincular.js
Normal file
32
dist-import/autenticacao/_usuarios_quipo_vincular.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import node_fetch from "cross-fetch";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
import { urlAutenticacao } from "./_urlAutenticacao";
|
||||
export const usuarios_quipo_vincular = ({ token_produto, ambiente, conta, vinculo, codigo_usuario, }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const url = `${urlAutenticacao(ambiente)}/api/vinculos__criar`;
|
||||
if (!token_produto)
|
||||
return respostaComuns.erro("token_produto não informado");
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
};
|
||||
const parametros = {
|
||||
codigo_conta: conta,
|
||||
codigo_usuario,
|
||||
vinculo,
|
||||
};
|
||||
return node_fetch(url, {
|
||||
headers,
|
||||
body: JSON.stringify(parametros),
|
||||
})
|
||||
.then((r) => String(r))
|
||||
.catch((e) => respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`))
|
||||
.then((r) => r);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue