refatoração

This commit is contained in:
Luiz H. R. Silva 2024-06-16 15:42:20 -03:00
parent 117bdbef7b
commit 8b8406e245
28 changed files with 300 additions and 51 deletions

View file

@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
import { respostaComuns } from "p-respostas";
import { z } from "zod";
import { PREFIXO, tiposSeriesAgregacoes, } from "./_variaveis";
import { PREFIXO, baseUrlPilao, tiposSeriesAgregacoes, } from "./_variaveis";
//registrar serie
export const zp_serie_registrar = z.object({
tabela: z.string(),
@ -19,9 +19,7 @@ export const zp_serie_registrar = z.object({
agregacao: tiposSeriesAgregacoes,
});
export const serie_registrar = ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { agregacao, colanuEixoX, colunaAgrupamento, identificador, tabela, }, }) => __awaiter(void 0, void 0, void 0, function* () {
const url = new URL(`${emDesenvolvimento
? "http://127.0.0.1:5080"
: "https://carro-de-boi.idz.one"}${`${PREFIXO}/registar-serie/${produto}/${conta}`}`);
const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${`${PREFIXO}/${Object.keys({ serie_registrar })[0]}/${produto}/${conta}`}`);
const resp = yield fetch(url.toString(), {
method: "POST",
body: JSON.stringify({