I am learning vuejs 3. And Vue Router.
I have this script in the "router.js" file (extract) :
router.beforeEach((to, from, next) => {
.....
if (to.meta.requiresAuth && loggedIn && !authorizedRoles.includes(roleId)) {
console.log('forbidden')
return {
path: '/forbidden'
}
}
.....
When the connected user has not the necessary authorizations, then it must be redirected to the page "forbidden". In my case, the conditions are KO. I see the message "forbidden" in the console , but there is no redirection.
If I go to the url "/forbidden", the page is correctly displayed.
What could be my problem ?