mirror of
https://github.com/catdevnull/transicion-desordenada-diablo
synced 2024-11-15 10:31:38 +00:00
frontend: solo printear json en dev
This commit is contained in:
parent
1c1553564d
commit
651a214bfb
1 changed files with 4 additions and 4 deletions
|
@ -4,15 +4,15 @@ import { zData, type Distribution, zError } from "./schema";
|
||||||
export async function downloadFile(
|
export async function downloadFile(
|
||||||
dataPath: string,
|
dataPath: string,
|
||||||
datasetId: string,
|
datasetId: string,
|
||||||
dist: Distribution
|
dist: Distribution,
|
||||||
) {
|
) {
|
||||||
const outputS = streamSaver.createWriteStream(
|
const outputS = streamSaver.createWriteStream(
|
||||||
dist.downloadURL.slice(dist.downloadURL.lastIndexOf("/") + 1)
|
dist.downloadURL.slice(dist.downloadURL.lastIndexOf("/") + 1),
|
||||||
);
|
);
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${dataPath}/${datasetId}/${dist.identifier}/${
|
`${dataPath}/${datasetId}/${dist.identifier}/${
|
||||||
dist.fileName || dist.identifier
|
dist.fileName || dist.identifier
|
||||||
}.gz`
|
}.gz`,
|
||||||
);
|
);
|
||||||
const ds = new DecompressionStream("gzip");
|
const ds = new DecompressionStream("gzip");
|
||||||
const decompressedStream = res.body!.pipeThrough(ds);
|
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 const gobData = `${endpoint}/datos.gob.ar_data.json`;
|
||||||
export async function fetchData(url: string) {
|
export async function fetchData(url: string) {
|
||||||
const json = await loadGzippedJson(`${url}/data.json.gz`);
|
const json = await loadGzippedJson(`${url}/data.json.gz`);
|
||||||
console.debug(json);
|
if (import.meta.env.DEV) console.debug(json);
|
||||||
return zData.parse(json);
|
return zData.parse(json);
|
||||||
}
|
}
|
||||||
export async function fetchErrors(url: string) {
|
export async function fetchErrors(url: string) {
|
||||||
|
|
Loading…
Reference in a new issue