| 123456789101112131415161718192021222324252627282930313233343536 |
- import { getList } from '@/api/unit'
- const getDefaultState = () => {
- return {
- units: []
- }
- }
- const state = getDefaultState()
- const mutations = {
- SET_UNITS: (state, units) => {
- state.units = units
- }
- }
- const actions = {
- // get units
- getUtils({ commit, state }) {
- return new Promise((resolve, reject) => {
- getList().then(response => {
- commit('SET_UNITS', response.data.list)
- resolve(response.data)
- }).catch(error => {
- reject(error)
- })
- })
- }
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- }
|