49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
import { createApp } from 'vue';
|
|
import { createWebHistory, createRouter } from 'vue-router';
|
|
import App from './App.vue';
|
|
import { createI18n } from 'vue-i18n';
|
|
import Toast from 'vue-toastification';
|
|
import 'windi.css';
|
|
import 'toastify-js/src/toastify.css';
|
|
import 'vue-toastification/dist/index.css';
|
|
import * as keys_en from './locales/en.json';
|
|
import * as keys_de from './locales/de.json';
|
|
|
|
const messages = {
|
|
en: keys_en,
|
|
de: keys_de
|
|
};
|
|
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
|
|
const i18n = createI18n({
|
|
locale: browserlocale,
|
|
fallbackLocale: 'en',
|
|
messages
|
|
});
|
|
|
|
// ---------------
|
|
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');
|
|
//
|
|
let routes = [ { path: '/', component: EnvError } ];
|
|
if (typeof config !== 'undefined') {
|
|
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 }
|
|
];
|
|
}
|
|
}
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes
|
|
});
|
|
// ---------------
|
|
createApp(App).use(Toast).use(i18n).use(router).mount('#app');
|