import { getData } from "@/api/approvalManagement/myApply";
  const getDefaultState = () => {
    return {
      tableData: [],
      loading: false,
      pagination: {
        pageSize: 10,
        pageNum: 1,
        total: 0,
      },
    }
  }
  const state = getDefaultState()
  const mutations = {
    GET_DATA(state, data) {
      state.tableData = data.list
      state.pagination.total = data.total
      state.loading = false
    },
  }
  const actions = {
    async getData({
      commit,
      dispatch
    }, data) {
      await getData(data).then(res => {
        try {
          commit('GET_DATA', res.body)
        } catch (err) {
          throw new Error(err)
        }
      })
    },
  }
  export default {
    namespaced: true,
    state,
    mutations,
    actions
  }
  