const auth = {
	state: {
		hasLogin:false,
		userToken:{},
		userInfo:{}
	},
	mutations: {
		doLogin(state, data) {
			state.hasLogin = true;
			state.userToken = data;
			uni.setStorage({
				key: 'userToken',
				data: data
			})
		},
		logout(state) {
			state.hasLogin = false;
			state.userInfo = {};
			state.userToken = {};
			uni.clearStorageSync();
		},
	},
	actions:{
		setLogin({ commit }, token){
			commit('doLogin', token);
		},
	}
}

export default auth;