This commit is contained in:
Luiz H. R. Silva 2024-06-19 17:47:48 -03:00
parent a6205f1ab6
commit e580643abc
40 changed files with 329 additions and 507 deletions

View file

@ -8,11 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
import { urlAutenticacao } from "./_urlAutenticacao";
import node_fetch from "cross-fetch";
/** faz a validação do token */
export const validarToken = ({ ambiente, post, buscar, }) => __awaiter(void 0, void 0, void 0, function* () {
export const validarToken = ({ ambiente, post, }) => __awaiter(void 0, void 0, void 0, function* () {
const url = `${urlAutenticacao(ambiente)}/api/validar_token`;
try {
const resposta = yield buscar(url, post)
const resposta = yield 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;