We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting "page not found" when next called
my router.js
... import { routeMetaPrepare } from './routeMetaPrepare'; import routesAuth from './group/auth'; .... Vue.use(Router); const routeList = [ routesAuth, ... ]; for (let i = 0; i < routeList.length; i++) { for (let j = 0; j < routeList[i].length; j++) { routes.push(routeMetaPrepare(routeList[i][j])); } } export function createRouter() { return new Router({ mode: 'history', routes }); }
routeMetaPrepare has logic to check auth state and pass or redirect user
export const ifAuthenticated = (to, from, next) => { const { authSuccess } = useAuth(); if (authSuccess.value) { next(); return; } next('/signin'); }; export const routeMetaPrepare = (routeInfo) => { const meta = routeInfo.meta || {}; switch (meta.auth) { case 'AUTH': routeInfo.beforeEnter = ifAuthenticated; break; default: break; } const children = routeInfo.children || []; for (let i = 0; i < children.length; i++) { routeInfo.children[i] = routeMetaPrepare(children[i]); } routeInfo.meta = meta; return routeInfo; };
if a user has no access then next func will be called. But next will redirecting to 404. It seems like there is no signin page.
The text was updated successfully, but these errors were encountered:
I'm using nuxt redirect function in 'auth' middleware as a temporary solution.
Sorry, something went wrong.
No branches or pull requests
Getting "page not found" when next called
my router.js
routeMetaPrepare has logic to check auth state and pass or redirect user
if a user has no access then next func will be called. But next will redirecting to 404. It seems like there is no signin page.
The text was updated successfully, but these errors were encountered: