Created
May 14, 2018 15:18
-
-
Save thefln/d08bd3d5afd4871d3e924c7c6d82826c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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