Remove Authentication Permanent

  1. Open src/pages/(main).vue

<route lang="json">
{
  "meta": {
    "requiresAuth": false // set to false
  }
}
</route>

  1. Remove/delete below codes from this files:

src/router/index.ts
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' };
  }
});

  1. Remove the below list of files and directories.

Last updated