ajuste na funcao de node_fetch

This commit is contained in:
MarcioJRGodoi 2024-06-25 08:54:43 -03:00
parent 059780f4c4
commit 84e3b9d377
4 changed files with 37 additions and 30 deletions

View file

@ -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>)
}