vuejs - Redirect from login/register to home if already loggedin, Redirect from other pages to login if not loggedin in vue-router
问题 I want to redirect user to home page if logged-in and wants to access login/register page and redirect user to login page if not logged-in and wants to access other pages. Some pages are excluded that means there is no need to be logged in so my code is right below: router.beforeEach((to, from, next) => { if( to.name == 'About' || to.name == 'ContactUs' || to.name == 'Terms' ) { next(); } else { axios.get('/already-loggedin') .then(response => { // response.data is true or false if(response