removido registros undefined
This commit is contained in:
parent
4860b2c036
commit
ceab73c21c
4 changed files with 29 additions and 4 deletions
|
|
@ -30,7 +30,9 @@ export const enviar_registros = ({ conta, produto, emDesenvolvimento }) => ({ re
|
|||
const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${PREFIXO}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`);
|
||||
const tamanhoBlocos = 1000;
|
||||
while (registros.length > 0) {
|
||||
const bloco = registros.splice(0, tamanhoBlocos);
|
||||
const bloco = registros
|
||||
.splice(0, tamanhoBlocos)
|
||||
.map((r) => Object.fromEntries(Object.entries(r).map(([k, v]) => [k, v === undefined ? null : v])));
|
||||
const resp = yield node_fetch(url.toString(), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ tabela, registros: bloco }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue