Feat(tag): New tag and delete tags

This commit is contained in:
2019-01-28 17:08:14 +01:00
parent 62ec65ce53
commit 1482c7f862
4 changed files with 25 additions and 39 deletions

View File

@@ -43,6 +43,9 @@ export default {
APPEND_TAG: (state, { tag }) => {
Vue.set(state.tags, tag.name.toLowerCase(), tag)
},
DELETE_TAG: (state, { tagname }) => {
Vue.delete(state.tags, tagname.toLowerCase())
},
SET_CATEGORIES: (state, { categories }) => {
state.categories = Object.keys(categories)
.reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {})
@@ -75,11 +78,16 @@ export default {
if (err) throw err
console.log('The file has been saved!')
})
},
edit_tag (context, tag) {
// Edit or append a tag to config
context.commit('APPEND_TAG', { tag: tag })
context.dispatch('save')
},
delete_tag (context, tagname) {
// Revome a tag from the config
context.commit('DELETE_TAG', { tagname: tagname })
context.dispatch('save')
}
}
}