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

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

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

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

export default noticeDetails
