build
This commit is contained in:
parent
a6205f1ab6
commit
e580643abc
40 changed files with 329 additions and 507 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue