import { getClientLanguage } from '@/constants/language'
import { AppTheme } from '@/constants/theme'
import WebStorage from '@/utils/storage'

// 本地存储
function createLocalData() {
    return {
        appLanguage: getClientLanguage(),
        appTheme: AppTheme.Default,
        accessToken: '', // 登录令牌
        autoLoginEncryptedData: '', // 自动登录加密数据
    }
}

// 会话存储
function createSessionData() {
    return {
        accessToken: '',
        userRoutes: <Model.MenusRsp[]>[],
        userInfo: <Model.LoginInRsp>{
            releType: 0,
            orgztypes: ''
        },
    }
}

export const localData = new WebStorage(localStorage, createLocalData())
export const sessionData = new WebStorage(sessionStorage, createSessionData())