add import node_fetch from "node-fetch";

This commit is contained in:
Luiz H. R. Silva 2024-06-19 10:33:55 -03:00
parent d614ba0d27
commit 5e04f26bbb
14 changed files with 87 additions and 17 deletions

View file

@ -1,8 +1,8 @@
import node_fetch from "node-fetch"
import type { tipoResposta } from "p-respostas"
import { respostaComuns } from "p-respostas"
import { z } from "zod"
import { PREFIXO, baseUrlPilao, type zp_produto_conta } from "./_variaveis"
//enviar registros para base de dados
export const zp_deletar_registros = z.object({
tabela: z.string(),
@ -32,7 +32,7 @@ export const deletar_registros = async ({
while (codigos.length > 0) {
const bloco = codigos.splice(0, tamanhoBlocos)
const resp = await fetch(url.toString(), {
const resp = await node_fetch(url.toString(), {
method: "POST",
body: JSON.stringify({ tabela, codigos: bloco }),
headers: { "Content-Type": "application/json" },

View file

@ -1,3 +1,4 @@
import node_fetch from "node-fetch"
import type { tipoResposta } from "p-respostas"
import { respostaComuns } from "p-respostas"
import { z } from "zod"
@ -55,7 +56,7 @@ export const enviar_registros = async ({
while (registros.length > 0) {
const bloco = registros.splice(0, tamanhoBlocos)
const resp = await fetch(url.toString(), {
const resp = await node_fetch(url.toString(), {
method: "POST",
body: JSON.stringify({ tabela, registros: bloco }),
headers: { "Content-Type": "application/json" },

View file

@ -1,3 +1,4 @@
import node_fetch from "node-fetch"
import type { tipoResposta } from "p-respostas"
import { respostaComuns } from "p-respostas"
import { z } from "zod"
@ -8,7 +9,6 @@ import {
type zp_produto_conta,
} from "./_variaveis"
import type { zp_serie_registrar } from "./serie_registrar"
//consultar compilação
export const zp_serie_consultar = z.object({
@ -39,7 +39,7 @@ export const serie_consultar = ({
}/${produto}/${conta}`}`,
)
const resp = await fetch(url.toString(), {
const resp = await node_fetch(url.toString(), {
method: "POST",
body: JSON.stringify({
identificador,

View file

@ -1,6 +1,6 @@
import node_fetch from "node-fetch"
import { respostaComuns, type tipoResposta } from "p-respostas"
import { z } from "zod"
import {
PREFIXO,
baseUrlPilao,
@ -42,7 +42,7 @@ export const serie_registrar = async ({
)}${`${PREFIXO}/${Object.keys({ serie_registrar })[0]}/${produto}/${conta}`}`,
)
const resp = await fetch(url.toString(), {
const resp = await node_fetch(url.toString(), {
method: "POST",
body: JSON.stringify({
tabela,