Fix login bug. Improve reservations
This commit is contained in:
@@ -36,12 +36,13 @@ export default route(function (/* { store, ssrContext } */) {
|
||||
});
|
||||
|
||||
Router.beforeEach((to) => {
|
||||
const auth = useAuthStore();
|
||||
const publicPages = routes
|
||||
.filter((route) => route.meta?.publicRoute)
|
||||
.map((r) => r.path);
|
||||
const authRequired = !publicPages.includes(to.path);
|
||||
|
||||
if (auth.currentUser) {
|
||||
return to.meta.accountRoute ? { name: 'index' } : true;
|
||||
} else {
|
||||
return to.name == 'login' ? true : { name: 'login' };
|
||||
if (authRequired && !useAuthStore().currentUser) {
|
||||
return '/login';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user