index.js 387 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import { getUserInfoApi } from '@/api';

export default {
    state: {
        userInfo: {},
    },
    mutations: {
        setUserInfo(state, userInfo) {
            state.userInfo = userInfo;
        },
    },
    actions: {
        async getUserInfo({ commit }) {
            const userInfo = await getUserInfoApi();
            commit('setUserInfo', userInfo);
        },
    },
};