Skip to content

Ho to dynamically change meta. #1645

Closed Answered by ghost
ghost asked this question in Help and Questions
Discussion options

You must be logged in to vote

I resole this problem by modificating meta in beforeEach hook.

router.beforeEach(async (to, from, next) => {
  const user = useUserStore();
  const $services = useServices();
  
  if(to.name === 404) {
    to.meta.layout = user.isAuthenticated ? "AppLayout" : "EmptyLayout";
  }

  next()
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
0 participants