@JoeDawson Hey.
The callback defined in .error() takes 3 arguments: data, status and xhr. That means you can just do something like:
getCategory: function() {
this.$http.get('/api/categories/' + this.$route.params.category + '?include=products', function(category) {
this.$set('category', category.data);
}).error(function(resp, status) {
if (status == 404) {
return this.$route.router.go('*')
}
console.log('404\'d');
});
}
As it currently stands the vue-router package has no interceptors (well there are interceptors in the develop branch) so you can't define a global hook where you can always catch a 404 responses and redirect to the not found page, so you have to manually do it now.
By the way, a word of advice, define yourcategory variable in the data of your VM even if it means setting it to null:
data: function () {
return {
category: null
}
}