Remove Authentication Permanent
<route lang="json">
{
"meta": {
"requiresAuth": false // set to false
}
}
</route>import { useAuthStore } from '@/stores/auth';
router.beforeEach((to) => {
const auth = useAuthStore();
const routeName = String(to.name ?? '');
const authRequired = routeName.startsWith('/(main)') || to.matched.some((record) => record.meta.requiresAuth === true);
if (authRequired && !auth.user) {
auth.returnUrl = to.fullPath;
return { path: '/login' };
}
if (auth.user && to.path === '/login') {
return { path: auth.returnUrl || '/dashboard/default' };
}
});Last updated