refactor: infer base URL from the BASE_URL env var across the app

This commit is contained in:
jamesgeorge007
2023-10-24 18:16:51 +05:30
parent 8703a0dcfd
commit 312940009e
2 changed files with 2 additions and 5 deletions

View File

@@ -41,10 +41,8 @@ export const isLoadingInitialRoute = readonly(_isLoadingInitialRoute);
export default <HoppModule>{
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,
});

View File

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