22 lines
555 B
JavaScript
22 lines
555 B
JavaScript
import node_fetch from "cross-fetch";
|
|
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(
|
|
(resposta2) => resposta2.eCerto ? "valido" : "erro"
|
|
).catch(() => "erro");
|
|
return resposta;
|
|
} catch (_e) {
|
|
return "erro";
|
|
}
|
|
};
|
|
export {
|
|
validarToken
|
|
};
|