fallback for env config errors

ref #3
This commit is contained in:
Philipp Dormann 2021-03-04 17:09:47 +01:00
parent 5a5261d6b0
commit 20229ab142
2 changed files with 18 additions and 4 deletions

View File

@ -0,0 +1,7 @@
<template>
<div></div>
</template>
<script setup>
//
</script>

View File

@ -21,21 +21,28 @@ const i18n = createI18n({
});
// ---------------
const EnvError = import('./components/EnvError.vue');
const Home = import('./components/Home.vue');
const Imprint = import('./components/Imprint.vue');
const Privacy = import('./components/Privacy.vue');
const Register = import('./components/Register.vue');
const Profile = import('./components/Profile.vue');
//
const router = createRouter({
history: createWebHistory(),
routes: [
let routes = [];
if (config.baseurl && config.documentserver_key) {
routes = [
{ path: '/', component: Home },
{ path: '/imprint', component: Imprint },
{ path: '/privacy', component: Privacy },
{ path: '/register', component: Register },
{ path: '/profile', component: Profile }
]
];
} else {
routes = [ { path: '/*', component: EnvError } ];
}
const router = createRouter({
history: createWebHistory(),
routes
});
// ---------------
createApp(App).use(Toast).use(i18n).use(router).mount('#app');