Refactor components. Improve design. Improve routing

This commit is contained in:
2023-11-17 17:15:37 -05:00
parent cbe4b5323e
commit f2d4ce12d4
17 changed files with 278 additions and 146 deletions

View File

@@ -35,13 +35,18 @@ export default route(function (/* { store, ssrContext } */) {
history: createHistory(process.env.VUE_ROUTER_BASE),
});
Router.beforeEach(async (to, from, next) => {
Router.beforeEach((to) => {
const auth = useAuthStore();
return !to.meta.accountRoute && !auth.currentUser
? next({ name: 'login' })
: to.meta.accountRoute && auth.currentUser
? next({ name: 'index' })
: next();
if (!auth.ready) {
return false;
}
if (auth.currentUser) {
return to.meta.accountRoute ? { name: 'index' } : true;
} else {
return to.name == 'login' ? true : { name: 'login' };
}
});
return Router;

View File

@@ -35,4 +35,10 @@ export const links = [
icon: 'info_outline',
front_links: true,
},
{
name: 'Tasks',
to: 'task',
icon: 'build',
front_links: true,
},
];

View File

@@ -25,6 +25,11 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/CertificationPage.vue'),
name: 'certification',
},
{
path: '/task',
component: () => import('pages/TaskPage.vue'),
name: 'task',
},
{
path: '/checklist',
component: () => import('pages/ChecklistPage.vue'),
@@ -63,7 +68,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/LoginPage.vue'),
name: 'login',
meta: {
accountRoute: true,
publicRoute: true,
},
},
// {