2017-09-29 18:12:00 +02:00
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
import * as types from './mutations-types';
|
|
|
|
|
|
|
|
export const initialState = {
|
|
|
|
questsItems: {},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mutations = {
|
|
|
|
[types.STORE_QUESTS_ITEMS](state, { type, items }) {
|
|
|
|
Vue.set(state.questsItems, type, items);
|
|
|
|
},
|
2017-11-21 22:11:58 +01:00
|
|
|
[types.REMOVE_QUEST_ITEM](state, { type, id }) {
|
2017-11-17 19:07:02 +01:00
|
|
|
const items = state.questsItems[type];
|
2017-11-21 22:11:58 +01:00
|
|
|
const index = items.findIndex(item => item.id === id);
|
|
|
|
if (index > -1) {
|
|
|
|
items.splice(index, 1);
|
|
|
|
}
|
2017-11-17 19:07:02 +01:00
|
|
|
Vue.set(state.questsItems, type, items);
|
|
|
|
},
|
2017-09-29 18:12:00 +02:00
|
|
|
};
|