Router.beforeEach

clipboard.png
clipboard.png

see that many blogs say that router.beforeEach, will be called again after calling next ("/ login") in router.beforeEach, but
! user=true and to.path!"/ login" do not call router.beforeEach, again after executing next ("/ login") for true, and next ("/ login") is still true in if condition, but if I change next ("/ login") to another route, there will be an endless loop call. Is it because of any change after the execution of next ("/ login")

Mar.12,2021

the logic you wrote above will be in an endless loop
after reading it for a long time, it feels like a sentence.

let user=xxxxxx
if(!user){
   next({ path: '/login' })
}else{
   next()
}

find out if the page you first opened is login,. If it is login, it will only be executed once

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be9b57-13ede.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be9b57-13ede.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?