From 20229ab14252e20ffb3ac0e3e8b9d8f7f31819a3 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 4 Mar 2021 17:09:47 +0100 Subject: [PATCH] fallback for env config errors ref #3 --- src/components/EnvError.vue | 7 +++++++ src/main.js | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 src/components/EnvError.vue diff --git a/src/components/EnvError.vue b/src/components/EnvError.vue new file mode 100644 index 0000000..5e5e93a --- /dev/null +++ b/src/components/EnvError.vue @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 59bcfe3..a733e63 100644 --- a/src/main.js +++ b/src/main.js @@ -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');