i want to redirect to login if there's no token and the page route is not one of these:
router.beforeEach((to, from, next) => {
if (to.name !== ('loginregister.loginpage' || 'index.index' || 'products.index') && !store.state.token) next({ name: 'loginregister.loginpage' });
else next() })
this code restrict me from going to any path other than login
router.beforeEach((to, from, next) => {
if (to.name !== 'loginregister.loginpage' && to.name !== 'index.index' && to.name !== 'products.index' && !store.state.token) next({ name: 'loginregister.loginpage' });
else next() })
Propably this is what you are looking for.