Static GitHub Issues

[135] How to access query parameters

prev: vuex configuration - strict mode
next: [Enhancement] Handle data() promise errors

Things like /objects?page=2.

When doing:

    async data ({ params }) {
      try {
        let BASE_URL = `http://localhost:8080/api/v1/nations`

        const { data } = await axios.get(BASE_URL)

        return {
          currentPage: data.currentPage,
          nations: data.data
        }
      } catch (e) {
        console.error(e)
      }
    }

I'm not sure how to access the this.$route.query.page.

this is undefined and params doesn't hold any query data, just the id i believe.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c113">#c113</a>)</em></sub></div>