No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    router.push in vuex actions

    Framework
    3
    4
    2698
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stukki
      stukki last edited by

      Re: Redirect to page after action
      Maybe not a hot topic but I saw the question here in the forum how to use this.$router.push in vuex.

      My solution is quite simple:

      1. I create an action
      export function routeToLogin () {
        this.$router.push({ path: '/login' })
      }
      
      1. Then I dispatch this action from any other action I like:
      export function logOut (context) {
        Vue.prototype.$axios.get(process.env.API + 'xxxx/' ...)
          .then(response => {
            ...
            context.dispatch('routeToLogin')
          })...
      }
      
      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        @stukki - This might be better in the “Useful Tips” forum.

        Scott

        stukki 1 Reply Last reply Reply Quote 0
        • stukki
          stukki @s.molinari last edited by

          @s-molinari Of course you’re right, sorry. I just replied to that post, at least I thought to.

          1 Reply Last reply Reply Quote 0
          • waelio
            waelio last edited by

            @stukki Amazing!! I was stuck and now I am not. Thank you for sharing. This ought to be the number 1 question 🙂

            1 Reply Last reply Reply Quote 0
            • First post
              Last post