build
This commit is contained in:
parent
ef9b4c746c
commit
4e1b415614
4 changed files with 74 additions and 16 deletions
|
|
@ -53,7 +53,14 @@ class ClassPilao {
|
|||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
return await response.json();
|
||||
const texto = await response.text();
|
||||
try {
|
||||
const json = JSON.parse(texto);
|
||||
return json;
|
||||
}
|
||||
catch {
|
||||
return respostaComuns.erro("Consulta não retornou json válido", [texto]);
|
||||
}
|
||||
}
|
||||
catch (erro) {
|
||||
console.error(erro);
|
||||
|
|
@ -106,13 +113,14 @@ class ClassPilao {
|
|||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(async (r) => {
|
||||
const texto = await r.text();
|
||||
try {
|
||||
return await r.json();
|
||||
const json = JSON.parse(texto);
|
||||
return json;
|
||||
}
|
||||
catch {
|
||||
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||
await r.text(),
|
||||
r.statusText,
|
||||
texto,
|
||||
]);
|
||||
}
|
||||
})
|
||||
|
|
@ -139,7 +147,18 @@ class ClassPilao {
|
|||
body: JSON.stringify(parametros),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then((r) => r.json())
|
||||
.then(async (r) => {
|
||||
const texto = await r.text();
|
||||
try {
|
||||
const json = JSON.parse(texto);
|
||||
return json;
|
||||
}
|
||||
catch {
|
||||
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||
texto,
|
||||
]);
|
||||
}
|
||||
})
|
||||
.catch((e) => respostaComuns.erro("Erro ao enviar registros", [e.message]));
|
||||
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||
console.log(`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url}".`);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,14 @@ class ClassPilao {
|
|||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
return await response.json();
|
||||
const texto = await response.text();
|
||||
try {
|
||||
const json = JSON.parse(texto);
|
||||
return json;
|
||||
}
|
||||
catch {
|
||||
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [texto]);
|
||||
}
|
||||
}
|
||||
catch (erro) {
|
||||
console.error(erro);
|
||||
|
|
@ -112,13 +119,14 @@ class ClassPilao {
|
|||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(async (r) => {
|
||||
const texto = await r.text();
|
||||
try {
|
||||
return await r.json();
|
||||
const json = JSON.parse(texto);
|
||||
return json;
|
||||
}
|
||||
catch {
|
||||
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [
|
||||
await r.text(),
|
||||
r.statusText,
|
||||
texto,
|
||||
]);
|
||||
}
|
||||
})
|
||||
|
|
@ -145,7 +153,18 @@ class ClassPilao {
|
|||
body: JSON.stringify(parametros),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then((r) => r.json())
|
||||
.then(async (r) => {
|
||||
const texto = await r.text();
|
||||
try {
|
||||
const json = JSON.parse(texto);
|
||||
return json;
|
||||
}
|
||||
catch {
|
||||
return p_respostas_1.respostaComuns.erro("Consulta não retornou json válido", [
|
||||
texto,
|
||||
]);
|
||||
}
|
||||
})
|
||||
.catch((e) => p_respostas_1.respostaComuns.erro("Erro ao enviar registros", [e.message]));
|
||||
if (__classPrivateFieldGet(this, _ClassPilao_ver_log, "f"))
|
||||
console.log(`[PILÃO]: buscar dados de "${JSON.stringify(parametros)}" para "${url}".`);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "p-drives",
|
||||
"version": "0.170.0",
|
||||
"version": "0.171.0",
|
||||
"description": "",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,15 @@ class ClassPilao {
|
|||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
return await response.json()
|
||||
|
||||
const texto = await response.text()
|
||||
|
||||
try {
|
||||
const json = JSON.parse(texto)
|
||||
return json
|
||||
} catch {
|
||||
return respostaComuns.erro("Consulta não retornou json válido", [texto])
|
||||
}
|
||||
} catch (erro) {
|
||||
console.error(erro)
|
||||
return respostaComuns.erroInterno({
|
||||
|
|
@ -149,12 +157,13 @@ class ClassPilao {
|
|||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then(async (r) => {
|
||||
const texto = await r.text()
|
||||
try {
|
||||
return await r.json()
|
||||
const json = JSON.parse(texto)
|
||||
return json
|
||||
} catch {
|
||||
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||
await r.text(),
|
||||
r.statusText,
|
||||
texto,
|
||||
])
|
||||
}
|
||||
})
|
||||
|
|
@ -223,7 +232,18 @@ class ClassPilao {
|
|||
body: JSON.stringify(parametros),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then((r) => r.json())
|
||||
.then(async (r) => {
|
||||
const texto = await r.text()
|
||||
|
||||
try {
|
||||
const json = JSON.parse(texto)
|
||||
return json
|
||||
} catch {
|
||||
return respostaComuns.erro("Consulta não retornou json válido", [
|
||||
texto,
|
||||
])
|
||||
}
|
||||
})
|
||||
.catch((e) =>
|
||||
respostaComuns.erro("Erro ao enviar registros", [e.message]),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue