isolamento de pacote
This commit is contained in:
commit
f34b66cbe4
96 changed files with 2285 additions and 0 deletions
20
dist-import/autenticacao/_validarToken.js
Normal file
20
dist-import/autenticacao/_validarToken.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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";
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue