I have a page with a dynamic route something like this:
async fetch({ store, route, app }) {
let url = `/api/${route.params.id}`
let data = await app.$axios.$get(url)
if (data.items.length === 0) {
// there's no data this should be a 404
}
store.commit('item', data.Items[0])
}
How can I throw that 404 in the if statement?
<!--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/c1570">#c1570</a>)</em></sub></div>