/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?
<!--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/c813">#c813</a>)</em></sub></div>