Skip to content

Instantly share code, notes, and snippets.

@gufranmirza
Created July 8, 2019 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gufranmirza/8aee7ae58b17988b5d01f3a0fae50e8e to your computer and use it in GitHub Desktop.
Save gufranmirza/8aee7ae58b17988b5d01f3a0fae50e8e to your computer and use it in GitHub Desktop.
// pages/products/_id.vue
export default {
fetch(({ store, params }) {
if (typeof (store.state.products.byId[params.id]) === 'undefined') {
return store.dispatch('products/loadProduct', {id: params.id});
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment