Feat(Categories): Show categories no filter yet
This commit is contained in:
@@ -8,7 +8,8 @@ export default {
|
||||
data_dir: '/home/lafrite/scripts/comptes/data/',
|
||||
config_dir: '/home/lafrite/scripts/comptes/config/',
|
||||
config_filename: 'config.yml',
|
||||
tags: {}
|
||||
tags: {},
|
||||
categories: {}
|
||||
},
|
||||
getters: {
|
||||
data_dir: (state) => {
|
||||
@@ -24,13 +25,23 @@ export default {
|
||||
return state.tags
|
||||
},
|
||||
tag: (state) => (tagname) => {
|
||||
return state.tags[tagname.toLowerCase()]
|
||||
return state.tags[tagname.toLowerCase()]
|
||||
},
|
||||
categories: (state) => {
|
||||
return state.categories
|
||||
},
|
||||
categorie: (state) => (categorieName) => {
|
||||
return state.categories[categorieName.toLowerCase()]
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
SET_TAGS: (state, { tags }) => {
|
||||
state.tags = Object.keys(tags)
|
||||
.reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {})
|
||||
state.tags = Object.keys(tags)
|
||||
.reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {})
|
||||
},
|
||||
SET_CATEGORIES: (state, { categories }) => {
|
||||
state.categories = Object.keys(categories)
|
||||
.reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {})
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -44,6 +55,7 @@ export default {
|
||||
}
|
||||
var parsed = yaml.safeLoad(content, parseConfig)
|
||||
context.commit('SET_TAGS', { tags: parsed.tags })
|
||||
context.commit('SET_CATEGORIES', { categories: parsed.categories })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user