refactor: infer base URL from the BASE_URL env var across the app
This commit is contained in:
@@ -41,10 +41,8 @@ export const isLoadingInitialRoute = readonly(_isLoadingInitialRoute);
|
|||||||
|
|
||||||
export default <HoppModule>{
|
export default <HoppModule>{
|
||||||
onVueAppInit(app) {
|
onVueAppInit(app) {
|
||||||
const basePath = import.meta.env.PROD && import.meta.env.VITE_INCLUDE_ADMIN_PREFIX === 'true' ? '/admin' : undefined
|
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(basePath),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const imgPrefix = import.meta.env.PROD && import.meta.env.VITE_INCLUDE_ADMIN_PREFIX === 'true' ? '/admin' : ''
|
const imgUrl = `${import.meta.env.BASE_URL}images/youre_lost.svg`
|
||||||
const imgUrl = `${imgPrefix}/images/youre_lost.svg`
|
|
||||||
|
|
||||||
const statusCode = computed(() => props.error?.statusCode ?? 404);
|
const statusCode = computed(() => props.error?.statusCode ?? 404);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user