Home

Issue: 2149

Payload undefined when navigating to page with nuxt-link

[issue link]

In my nuxt.config.js, I have:

generate: {
        routes: function () {
            return axios.get('https://someapi.com/api/produkter').then(function (res) {
                const produkter = res.data.map(el => el.fields)
                return [{
                    route: '/produkter/anledninger/jul',
                    payload: produkter
                }]
            })
        }
},

In my page (pages/produkter/anledninger/_id.vue), I have:

async asyncData ({ params, error, payload }) {
            console.log('payload', payload)
            return {
                produkter: payload
            }
}

Generating static site with nuxt generate.
When I navigate to this page via a nuxt-link, payload is undefined. Upon refresh (or navigating via < a>), payload is populated with the data.

Using nuxt 1.0.0-rc11.

This question is available on Nuxt.js community (#c1904)