i want to redirect user based on their role & other attributes via nuxt middleware.
** Redirection happen but got stuck into navigation guard, and page automatically reload again and again (reload ~500 times in second).
#here is my code
nuxt.config.js
router: {
middleware: ['role']
},
middleware/role.js
export default function ({ redirect }) {
if (!window.localStorage.getItem('auth.token')) {
return redirect('/auth/login')
}
}