Feat(tag): Save modification in vuex

This commit is contained in:
Bertrand Benjamin 2019-01-28 12:14:56 +01:00
parent 48df3ecf7b
commit 342b2efd1c
1 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { readFile } from 'fs'
import Vue from 'vue'
import path from 'path'
import yaml from 'js-yaml'
@ -39,6 +40,9 @@ export default {
state.tags = Object.keys(tags)
.reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {})
},
APPEND_TAG: (state, { tag }) => {
Vue.set(state.tags, tag.name.toLowerCase(), tag)
},
SET_CATEGORIES: (state, { categories }) => {
state.categories = Object.keys(categories)
.reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {})
@ -60,7 +64,7 @@ export default {
})
},
edit_tag (context, tag) {
console.log(tag)
context.commit('APPEND_TAG', { tag: tag })
}
}
}