import userApi from '../api/userApi'

const state = {
    user:{}
}
const mutations = {
    setUser(state, user){
        state.user = user
    }
}
const actions = {
    getUserInfo({commit}){
        userApi.getUserInfo((response)=>{
            if(response.data.code === 200){
                commit('setUser', {username:response.data.content})
            }
        })
    }
}
export default {
    namespaced: true,
    state,
    actions,
    mutations
}