import appConfig from '@/config/appConfig.js'
import storageManage from '@/util/storageManage.js';
import { $userInfo, $logout } from '@/http/apiManager.js'

let USER_INFO = null

const user = {
	
	// 退出登录，清空token
	logout() {
		
		// 退出登录接口
		$logout()
		
		// 清空用户信息
		USER_INFO = null
		
		// 清空token
		storageManage.token('', true)
		
		uni.reLaunch({
			url: '/pages/login/login'
		})
	}
}

function reqUserInfo() {
		return $userInfo()
	}
	
export default user

