From 5ba9e95547cb0a587f7333050406488b7e4cc736 Mon Sep 17 00:00:00 2001 From: Spythere Date: Tue, 4 Jul 2023 23:44:06 +0200 Subject: [PATCH] =?UTF-8?q?=C5=9Brodowisko=20dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ src/App.vue | 14 +++++++------- src/types.ts | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6999898..3331163 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ pnpm-debug.log* *.sln *.sw? node_modules + +# Dev files +stockInfoDev.json \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 54bce06..ad9d7d3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -73,13 +73,13 @@ export default defineComponent({ }), async created() { - const stockData = await ( - await fetch( - `https://spythere.github.io/api/td2/data/stockInfo${import.meta.env['VITE_STOCK_DEV'] == '1' ? 'Dev' : ''}.json` - ) - ).json(); - - this.store.stockData = stockData; + if (import.meta.env['VITE_STOCK_DEV'] == '1') { + const data = await import('../stockInfoDev.json'); + this.store.stockData = data.default as any; + } else { + const stockData = await (await fetch(`https://spythere.github.io/api/td2/data/stockInfo.json`)).json(); + this.store.stockData = stockData; + } // routing switch (window.location.pathname) { diff --git a/src/types.ts b/src/types.ts index c817477..2f4d482 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,7 +42,7 @@ export interface IStockProps { export interface IStockData { generator: { - passenger: []; + passenger: any; cargo: { [key: string]: string[]; };