Add prettier dependency to format frontend code
This commit is contained in:
@@ -31,13 +31,13 @@ export const router = createRouter({
|
||||
})
|
||||
|
||||
router.beforeEach(async (to) => {
|
||||
// redirect to login page if not logged in and trying to access a restricted page
|
||||
const publicPages = ['/', '/login', '/signup'];
|
||||
const authRequired = !publicPages.includes(to.path);
|
||||
const auth = useAuthStore();
|
||||
// redirect to login page if not logged in and trying to access a restricted page
|
||||
const publicPages = ['/', '/login', '/signup']
|
||||
const authRequired = !publicPages.includes(to.path)
|
||||
const auth = useAuthStore()
|
||||
|
||||
if (authRequired && !auth.user) {
|
||||
auth.returnUrl = to.fullPath;
|
||||
return '/login';
|
||||
}
|
||||
});
|
||||
if (authRequired && !auth.user) {
|
||||
auth.returnUrl = to.fullPath
|
||||
return '/login'
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user