autenticacao-drive/dist-import/autenticacao/_validarToken.js
2025-07-06 18:35:12 -03:00

20 lines
651 B
JavaScript

import node_fetch from "cross-fetch";
/** faz a validação do token */
export const validarToken = async ({ url_api_autenticacao, post, }) => {
const url = `${url_api_autenticacao}/api/validar_token`;
try {
const resposta = await node_fetch(url, {
method: "POST",
body: JSON.stringify(post),
headers: { "Content-Type": "application/json" },
})
.then((r) => r.json())
.then((r) => r)
.then((resposta) => resposta.eCerto ? "valido" : "erro")
.catch(() => "erro");
return resposta;
}
catch (_e) {
return "erro";
}
};