Make deep clone of resources, access state by getter
This commit is contained in:
@@ -2,6 +2,10 @@ export const state = () => ({
|
||||
cardsShown: true
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
isCardsShown: state => state.cardsShown
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
toggleCardsShown(state) {
|
||||
console.log(state.cardsShown)
|
||||
|
||||
@@ -61,10 +61,10 @@ export const getters = {
|
||||
},
|
||||
sortByTitle: (_, getters) => title => {
|
||||
const category = getters.findResources(title)
|
||||
const copy = [...category.resources]
|
||||
const clone = [...category.resources]
|
||||
return {
|
||||
...category,
|
||||
resources: copy.sort(compareTitles)
|
||||
resources: clone.sort(compareTitles)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user