routing improved, settings initialized

This commit is contained in:
Torsten Schulz
2024-07-21 18:47:45 +02:00
parent 12d66d6f9c
commit cd0699f3fd
23 changed files with 476 additions and 69 deletions

View File

@@ -1,6 +1,8 @@
import { createRouter, createWebHistory } from 'vue-router';
import store from '../store';
import HomeView from '../views/HomeView.vue';
import ActivateView from '../views/auth/ActivateView.vue';
import PeronalSettingsView from '../views/settings/PersonalView.vue';
const routes = [
{
@@ -12,9 +14,16 @@ const routes = [
path: '/activate',
name: 'Activate page',
component: ActivateView
},
{
path: '/settings/personal',
name: 'Personal settings',
component: PeronalSettingsView,
meta: { requiresAuth: true }
}
];
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
@@ -24,10 +33,10 @@ router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth)) {
if (!store.getters.isLoggedIn) {
next('/');
} else if (!store.user.active) {
next();
} else {
} else if (!store.getters.user.active) {
next('/activate');
} else {
next();
}
} else {
next();