From 651a214bfb2fc6a7371a10da9ca141b2d0dfea3c Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 7 Dec 2023 20:23:54 -0300 Subject: [PATCH] frontend: solo printear json en dev --- frontend/src/lib/dump.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/dump.ts b/frontend/src/lib/dump.ts index b6adddc..69caeae 100644 --- a/frontend/src/lib/dump.ts +++ b/frontend/src/lib/dump.ts @@ -4,15 +4,15 @@ import { zData, type Distribution, zError } from "./schema"; export async function downloadFile( dataPath: string, datasetId: string, - dist: Distribution + dist: Distribution, ) { const outputS = streamSaver.createWriteStream( - dist.downloadURL.slice(dist.downloadURL.lastIndexOf("/") + 1) + dist.downloadURL.slice(dist.downloadURL.lastIndexOf("/") + 1), ); const res = await fetch( `${dataPath}/${datasetId}/${dist.identifier}/${ dist.fileName || dist.identifier - }.gz` + }.gz`, ); const ds = new DecompressionStream("gzip"); const decompressedStream = res.body!.pipeThrough(ds); @@ -35,7 +35,7 @@ const endpoint = "http://localhost:8081"; export const gobData = `${endpoint}/datos.gob.ar_data.json`; export async function fetchData(url: string) { const json = await loadGzippedJson(`${url}/data.json.gz`); - console.debug(json); + if (import.meta.env.DEV) console.debug(json); return zData.parse(json); } export async function fetchErrors(url: string) {