const user = {
    get userInfo() {
        if (localStorage.b2bUser) {
            let u = JSON.parse(window.localStorage.getItem('b2bUser'))
            console.log('鑒定權限........', u)
            if (u.token) {
                return u
            } else {
                localStorage.removeItem('b2bUser')
                return null
            }

        } else {
            return null
        }
    },
    set userInfo(u) {
        if (u) {
            localStorage.setItem('b2bUser', JSON.stringify(u))
        } else {
            //localStorage.removeItem('b2bUser')
        }
    },
    loginOut() {
        localStorage.setItem('b2bUser', JSON.stringify(u))
    },
    appraisal() {
        if (!user.userInfo) {
            this.CommonJump('/login', { r: encodeURIComponent(location.href) });
        }
    }
}


export default user