Nuxt.js – redirect

The router docs are a little bit muddy with redirects.

Push the new route onto the stack to redirect.

this.$router.push(`/users/${id}`)

Replace the route on the stack to replace in the browser.

this.$router.replace(`/users/${id}`)

Extra: Updating querystring

Changes the querystring in the URL bar to match the filters parameter.

Uses ‘replace’ to save polluting the back history (I hate that so much!)

        this.$router.replace(
          { path: this.$route.path, query: this.filters },
          e => {}
        )