From 342b2efd1ceea99981654ce2af5dfee297bc8b53 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Mon, 28 Jan 2019 12:14:56 +0100 Subject: [PATCH] Feat(tag): Save modification in vuex --- src/store/modules/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/store/modules/config.js b/src/store/modules/config.js index d7b4ade..94298db 100644 --- a/src/store/modules/config.js +++ b/src/store/modules/config.js @@ -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 }) } } }