如果用户未经身份验证,我需要将用户重定向到登录页面。我需要类似route.beforeEachVue.js 的东西,理想情况下:
sapper.beforeRouteChange((to, from, next) => {
  const isAuth = "[some session or token check]";
  if (!isAuth) {
    next('/login')
  }
  next()
})
我发现了Sapper - protected routes (route guard)这个问题,但我认为这不足以满足我的需求。如果令牌或身份验证在运行时发生变化怎么办?或者它是否被反应性覆盖?
编辑 1:我认为Sapper GitHub 上的这个问题解决了我的问题。