convertido para pnpm
This commit is contained in:
parent
59e710f6cf
commit
175d767d27
115 changed files with 2366 additions and 1451 deletions
54
dist-front/lista-vinculos.js
Normal file
54
dist-front/lista-vinculos.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import cFetch from "cross-fetch";
|
||||
import { cacheM } from "p-comuns";
|
||||
import { respostaComuns } from "p-respostas";
|
||||
import { uuidV3 } from "./plugins/uuid";
|
||||
const tx_vinculos__listar = "vinculos__listar";
|
||||
const listarVinculos = async ({
|
||||
token,
|
||||
url_api_autenticacao,
|
||||
desativarCache
|
||||
}) => {
|
||||
const chaveCache = uuidV3({ token, url_api_autenticacao });
|
||||
if (!desativarCache) {
|
||||
const valorCache = cacheM(chaveCache);
|
||||
if (valorCache) return valorCache;
|
||||
}
|
||||
const res = (async () => {
|
||||
const url = `${url_api_autenticacao}/api/${tx_vinculos__listar}`;
|
||||
return cFetch(url, {
|
||||
headers: { token, "Content-Type": "application/json" },
|
||||
body: "{}",
|
||||
method: "post"
|
||||
}).then(async (a) => {
|
||||
const texto = await a.text();
|
||||
try {
|
||||
const res2 = JSON.parse(texto);
|
||||
return res2;
|
||||
} catch (error) {
|
||||
return respostaComuns.erro(
|
||||
`Erro ao listar cidades: ${error.message}`,
|
||||
[texto, error]
|
||||
);
|
||||
}
|
||||
}).catch(
|
||||
(error) => respostaComuns.erro(`Erro ao listar cidades: ${error.message}`, [
|
||||
error
|
||||
])
|
||||
);
|
||||
})();
|
||||
cacheM(
|
||||
chaveCache,
|
||||
res.then((a) => {
|
||||
try {
|
||||
} catch {
|
||||
}
|
||||
return a;
|
||||
}),
|
||||
10
|
||||
);
|
||||
return res;
|
||||
};
|
||||
export {
|
||||
listarVinculos,
|
||||
tx_vinculos__listar
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue