Home

Issue: 945

nuxt-link params refresh page params undefined.

[issue link]

/news/index.vue

<div>
    Posted in News By
    <nuxt-link :to="{ name: 'news-author-name', params: { name: post.author_name, id: post.author_id } }" append>
        {{ post.author_name }}
    </nuxt-link>
</div>

/news/author/_name.vue

export default {
    async asyncData ({ req, params }) {
        return axios.get(`${process.env.API_URL}/api/tags/${params.id}/posts`)
            .then((res) => {
                return { posts: res.data }
            })
    }
}

browser url is : domain/news/author/admin
first time run is ok, when i refresh page show Nuxt.js Error: 500. because params undefined.

How should I fix it?

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