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