build
This commit is contained in:
parent
d0808a86dc
commit
ef9b4c746c
4 changed files with 33 additions and 4 deletions
|
|
@ -105,7 +105,17 @@ class ClassPilao {
|
||||||
body: JSON.stringify({ tabela, registros: bloco }),
|
body: JSON.stringify({ tabela, registros: bloco }),
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
.then((r) => r.json())
|
.then(async (r) => {
|
||||||
|
try {
|
||||||
|
return await r.json();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
await r.text(),
|
||||||
|
r.statusText,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch((e) => respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
|
.catch((e) => respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
|
||||||
if (resp.eErro)
|
if (resp.eErro)
|
||||||
return resp;
|
return resp;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,17 @@ class ClassPilao {
|
||||||
body: JSON.stringify({ tabela, registros: bloco }),
|
body: JSON.stringify({ tabela, registros: bloco }),
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
.then((r) => r.json())
|
.then(async (r) => {
|
||||||
|
try {
|
||||||
|
return await r.json();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
await r.text(),
|
||||||
|
r.statusText,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
|
.catch((e) => p_respostas_1.respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]));
|
||||||
if (resp.eErro)
|
if (resp.eErro)
|
||||||
return resp;
|
return resp;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "p-drives",
|
"name": "p-drives",
|
||||||
"version": "0.169.0",
|
"version": "0.170.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,16 @@ class ClassPilao {
|
||||||
body: JSON.stringify({ tabela, registros: bloco }),
|
body: JSON.stringify({ tabela, registros: bloco }),
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
})
|
})
|
||||||
.then((r) => r.json())
|
.then(async (r) => {
|
||||||
|
try {
|
||||||
|
return await r.json()
|
||||||
|
} catch {
|
||||||
|
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||||
|
await r.text(),
|
||||||
|
r.statusText,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch((e) =>
|
.catch((e) =>
|
||||||
respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]),
|
respostaComuns.erro(`Erro ao ${acao} registros`, [e.message]),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue