Skip to content

how to use : router.push('/home') #1142

Discussion options

You must be logged in to vote

You can add the router to stores: https://pinia.vuejs.org/core-concepts/plugins.html#adding-new-external-properties and then use them with this.router inside actions.

for setup stores, you can just call useRouter() as long as they are used inside of components (normal usage):

defineStore('auth', () => {
  const router = useRouter()
  // ...
})

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@adityafawzan
Comment options

@posva
Comment options

@adityafawzan
Comment options

@adityafawzan
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants