import { getTokenInfo } from '@/assets/utils/code.js'
export default {
    saveToken (state, token) {
        state.token = token
        state.tokenPayload = getTokenInfo(token)
        state.tokenInfo = getTokenInfo(token, true)
        try {
            localStorage.setItem('token', token)
        } catch (e) {}
    },
    saveExpireTime (state, expireTime) {
        state.expireTime = expireTime
        try {
            localStorage.setItem('expireTime', expireTime)
        } catch (e) {}
    },
    saveSchoolCode (state, schoolCode) {
        state.schoolCode = schoolCode
        try {
            localStorage.setItem('storeSchoolCode', schoolCode)
        } catch (e) {}
    },
    saveUserinfo (state, userinfo) {
        state.userinfo = userinfo
        try {
            localStorage.setItem('userInfo', JSON.stringify(userinfo))
        } catch (e) {}
    },
    saveOriginInfo (state, data) {
        state.isOldVsscmp = data
    }
}
