frontend: solo printear json en dev

This commit is contained in:
Cat /dev/Nulo 2023-12-07 20:23:54 -03:00
parent 1c1553564d
commit 651a214bfb

View file

@ -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) {