From e43dca7d57e55e36954e3e3a0cd2d33211bfdfb6 Mon Sep 17 00:00:00 2001 From: Paul Pestov <10750176+paulpestov@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:12:49 +0200 Subject: [PATCH] feat: add public path and base API URL to env variables --- .env | 2 ++ src/helpers/api.ts | 4 ++-- vite.config.js | 41 ++++++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..d31cb27 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +VITE_BASE_PATH=/quiver-frontend/ +VITE_BASE_API_URL=https://quiver-dev.sub.uni-goettingen.de/api diff --git a/src/helpers/api.ts b/src/helpers/api.ts index 9821708..df28548 100644 --- a/src/helpers/api.ts +++ b/src/helpers/api.ts @@ -1,7 +1,7 @@ import type { EvalDefinitions, EvaluationRun, GroundTruth, Project, Release, Workflow } from "@/types" const baseUrlOld = 'https://raw.githubusercontent.com/OCR-D/quiver-back-end/main/data' -const baseUrl = 'https://quiver-dev.sub.uni-goettingen.de/api' +const baseUrl = import.meta.env.VITE_BASE_API_URL async function getProjects(): Promise { return await request(baseUrlOld + '/repos.json') } @@ -40,7 +40,7 @@ async function getLatestRuns(gtId?: string, workflowId?: string): Promise { + const env = loadEnv(mode, process.cwd(), '') + return { + base: env.VITE_BASE_PATH, + build: { + outDir: 'dist', + }, + publicDir: 'assets', + plugins: [ + vue(), + VueI18nPlugin({ + // if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false` + // compositionOnly: false, - // you need to set i18n resource including paths ! - include: path.resolve(__dirname, './src/locales/**') - }), - ], - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)) + // you need to set i18n resource including paths ! + include: path.resolve(__dirname, './src/locales/**') + }), + ], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + } } } })