From 312940009eee9e35f29fe328dc6f00e7591469c7 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Tue, 24 Oct 2023 18:16:51 +0530 Subject: [PATCH] refactor: infer base URL from the BASE_URL env var across the app --- packages/hoppscotch-sh-admin/src/modules/router.ts | 4 +--- packages/hoppscotch-sh-admin/src/pages/_.vue | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-sh-admin/src/modules/router.ts b/packages/hoppscotch-sh-admin/src/modules/router.ts index e07cc5b2b..f7ab4b735 100644 --- a/packages/hoppscotch-sh-admin/src/modules/router.ts +++ b/packages/hoppscotch-sh-admin/src/modules/router.ts @@ -41,10 +41,8 @@ export const isLoadingInitialRoute = readonly(_isLoadingInitialRoute); export default { onVueAppInit(app) { - const basePath = import.meta.env.PROD && import.meta.env.VITE_INCLUDE_ADMIN_PREFIX === 'true' ? '/admin' : undefined - const router = createRouter({ - history: createWebHistory(basePath), + history: createWebHistory(import.meta.env.BASE_URL), routes, }); diff --git a/packages/hoppscotch-sh-admin/src/pages/_.vue b/packages/hoppscotch-sh-admin/src/pages/_.vue index c7c607622..43d5e2219 100644 --- a/packages/hoppscotch-sh-admin/src/pages/_.vue +++ b/packages/hoppscotch-sh-admin/src/pages/_.vue @@ -44,8 +44,7 @@ const props = defineProps({ }, }); -const imgPrefix = import.meta.env.PROD && import.meta.env.VITE_INCLUDE_ADMIN_PREFIX === 'true' ? '/admin' : '' -const imgUrl = `${imgPrefix}/images/youre_lost.svg` +const imgUrl = `${import.meta.env.BASE_URL}images/youre_lost.svg` const statusCode = computed(() => props.error?.statusCode ?? 404);