Feat(tag): New tag and delete tags
This commit is contained in:
@@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user