wxAuth.js 748 Bytes
Newer Older
1
import pagination from '../../../store/modules/pagination';
姜雷 committed
2
import { fetchList } from '@/api/system/wxAuth';
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
import { GET_AUTH_LIST } from './mutation-types';

const state = {
  list: [],
};
const getters = {
  list: state => state.list,
};
const actions = {
  fetchList({ dispatch, state, commit }, entity) {
    return fetchList({
      ...state.pagination,
      ...entity,
    }).then(res => {
      const { list, ...pagination } = res.data;
      dispatch('updatePagination', pagination);
      commit(GET_AUTH_LIST, list);
    });
  },
};
const mutations = {
  [GET_AUTH_LIST](state, list) {
    state.list = list;
  },
};

export default {
  namespaced: true,
  modules: {
    pagination,
  },
  state,
  getters,
  actions,
  mutations,
};