import { getTokenInfo } from '@/assets/utils/code.js'

let defaultToken = ''
try {
    if (localStorage.token) {
        defaultToken = localStorage.token
    }
} catch (e) {}

let defaultExpireTime = 0
try {
    if (localStorage.expireTime) {
        defaultExpireTime = localStorage.expireTime
    }
} catch (e) {}

let defaultSchoolCode = '10086'
try {
    if (localStorage.storeSchoolCode) {
        defaultSchoolCode = localStorage.storeSchoolCode
    }
} catch (e) {}

let userinfo = {}
try {
    if (localStorage.userInfo) {
        userinfo = JSON.parse(localStorage.userInfo)
    }
} catch (e) {}

export default {
    isOldVsscmp: false,
    token: defaultToken,
    tokenPayload: getTokenInfo(defaultToken),
    tokenInfo: getTokenInfo(defaultToken, true),
    expireTime: defaultExpireTime,
    schoolCode: defaultSchoolCode,
    userinfo
}
