To.matched.some (function (item) {}

router.beforeEach ((to, from, next) = > {
if (to.matched.some (record = > record.meta.requiresAuth)) {

 
  if (!localStorage.token) { 
    next({
      path: "/login",
      query: { redirect: to.fullPath }
    })
  } else {
    next()
  }
} else {
  next() //  next()
}

})
to.matched.some (record = > record.meta.requiresAuth) what is the meaning of this paragraph? do you know any great gods?

Jul.24,2021

you can take a look at the some method of es6. What this means is that the array of to.matched returns true

if there is requiresAuth in mate.
Menu