Skip to content

Instantly share code, notes, and snippets.

@thefln
Created May 14, 2018 15:18
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 thefln/d08bd3d5afd4871d3e924c7c6d82826c to your computer and use it in GitHub Desktop.
Save thefln/d08bd3d5afd4871d3e924c7c6d82826c to your computer and use it in GitHub Desktop.
import butter from '@/buttercms';
import NotFound from './NotFound';
export default {
name: 'ProductPage',
components: {
NotFound,
},
data() {
return {
product: {
slug: '',
fields: {},
},
notFound: false,
};
},
// here
props: ['slug'],
methods: {
getProduct() {
// and here, that's it! :)
butter.page.retrieve('product', this.slug)
.then((res) => {
this.product = res.data.data;
}).catch(() => {
this.notFound = true;
});
},
},
created() {
this.getProduct();
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment