/**
 * 封装历史投诉列表项数据缓存
 * @author Rockery(1113269755@qq.com)
 */

const complaintsDetails = {
  state: {
    itemData: {}
  },

  mutations: {
    SET_ITEMDATA: (state, itemData) => {
      state.itemData = itemData;
    },
    CLEAR_ITEMDATA: (state, itemData) => {
      state.itemData = itemData;
    }
  },

  actions: {
    SetComplaintsDetails({ commit }, itemData) {
      return new Promise((resolve, reject) => {
        if (itemData) {
          commit('SET_ITEMDATA', itemData);
          resolve();
        } else {
          reject('error');
        }
      });
    },
    ClearComplaintsDetails({ commit }) {
      return new Promise(resolve => {
        commit('CLEAR_ITEMDATA', {});
        resolve()
      });
    }
  }
}

export default complaintsDetails
