Find resources from store
This commit is contained in:
@@ -13,12 +13,11 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
categoryRouteTitle: this.$route.params.category,
|
||||
categories: this.$store.state.resources,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
category() {
|
||||
return this.categories.find(category => category.title.toLowerCase() === this.categoryRouteTitle.toLowerCase())
|
||||
category() {
|
||||
return this.$store.getters['resources/findResources'](this.categoryRouteTitle)
|
||||
}
|
||||
},
|
||||
components: { Card },
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import resources from '../resources/'
|
||||
|
||||
export const state = () => resources
|
||||
export const state = () => resources
|
||||
|
||||
export const getters = {
|
||||
findResources: state => title => {
|
||||
return state.find(resource => resource.title.toLowerCase() === title.toLowerCase())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user