// 用户的状态
import { userinfo } from "@/api/user"
export default {
	state: {
		userInfo: {
			username: '',
			nickname: '',
			belongUserId: '',
			isChildUser: false,
			token: ''
		}
	},
	getters: {
		userInfo: state => {
			return state.userInfo
		},
		token: state => {
			return state.userInfo.token
		},
	},
	mutations: {
		/**
		 * 更新用户信息状态
		 * @param {Object} state
		 * @param {Object} userInfo
		 */
		setUserInfo(state,userInfo){
			state.userInfo = {
				...state.userInfo,
				...userInfo
			}
		},
		/**
		 * 退出登录
		 * @param {Object} state
		 */
		logout(state){
			state.userInfo = {}
		}
	},
	actions: {
		
	}
}