Feat(tag): Save modification in vuex
This commit is contained in:
parent
48df3ecf7b
commit
342b2efd1c
@ -1,4 +1,5 @@
|
|||||||
import { readFile } from 'fs'
|
import { readFile } from 'fs'
|
||||||
|
import Vue from 'vue'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
|
|
||||||
@ -39,6 +40,9 @@ export default {
|
|||||||
state.tags = Object.keys(tags)
|
state.tags = Object.keys(tags)
|
||||||
.reduce((c, k) => (c[k.toLowerCase()] = tags[k], c), {})
|
.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 }) => {
|
SET_CATEGORIES: (state, { categories }) => {
|
||||||
state.categories = Object.keys(categories)
|
state.categories = Object.keys(categories)
|
||||||
.reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {})
|
.reduce((c, k) => (c[k.toLowerCase()] = categories[k], c), {})
|
||||||
@ -60,7 +64,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
edit_tag (context, tag) {
|
edit_tag (context, tag) {
|
||||||
console.log(tag)
|
context.commit('APPEND_TAG', { tag: tag })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user