import { urlAutenticacao } from "./_urlAutenticacao"; import node_fetch from "cross-fetch"; /** faz a validação do token */ export const validarToken = async ({ ambiente, post, }) => { const url = `${urlAutenticacao(ambiente)}/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"; } };