Update tag mutation

This commit is contained in:
Roman Cervantes 2019-07-25 15:36:35 -07:00
parent e2db5694e4
commit df262c2e7a

View file

@ -26,6 +26,22 @@ export default {
state.wallpaperUrl = url;
},
UPDATE_TAG(state, { tagName, tagHex, tempTag }) {
const updatedTag = {
...state.tags[tempTag.tagName],
hex: tagHex,
};
const renaming = tagName !== tempTag.tagName;
if (renaming) {
Vue.set(state.tags, tagName, updatedTag);
Vue.delete(state.tags, tempTag.tagName);
} else {
state.tags[tempTag.tagName] = updatedTag;
}
},
SET_RELEASES(state, releases) {
state.releases = releases;
},