ajuste na funcao de node_fetch
This commit is contained in:
parent
059780f4c4
commit
84e3b9d377
4 changed files with 37 additions and 30 deletions
|
|
@ -22,24 +22,22 @@ export const usuarios_quipo_vincular = async ({
|
|||
const url = `${urlAutenticacao(ambiente)}/api/vinculos__criar`
|
||||
|
||||
if (!token_produto) return respostaComuns.erro("token_produto não informado")
|
||||
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
const parametros = {
|
||||
vinculos: { codigo_conta: conta, codigo_usuario, vinculo },
|
||||
email: email,
|
||||
}
|
||||
|
||||
return node_fetch(url, {
|
||||
return await node_fetch(url, {
|
||||
headers,
|
||||
body: JSON.stringify(parametros),
|
||||
method: "POST",
|
||||
})
|
||||
.then((r) => String(r))
|
||||
.then(async (r) => await r.json())
|
||||
.catch((e) =>
|
||||
respostaComuns.erro(`Erro ao criar vinculo de usuario ${e.message}`),
|
||||
)
|
||||
.then((r) => r as tipoResposta<string>)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue