enum Keys {
    Token = 'token',
    UserId = 'userId',
    ExpireTime = 'expireTime',
    DeptCodeList = '_deptCodeList_',
    SysUserRoleDto = '_sysUserRoleDto_'
}
//存储token到session
export const setToken = (token: string) => {
    sessionStorage.setItem(Keys.Token, token)
}
export const getToken = () => {
    return sessionStorage.getItem(Keys.Token)
}
//存储userId到sessionStorage
export const setUserId = (userId: number) => {
    sessionStorage.setItem(Keys.UserId, JSON.stringify(userId))
}
export const setDeptCodeList = (list: string[]) => {
    return sessionStorage.setItem(Keys.DeptCodeList, JSON.stringify(list))
}
export const setSysUserRoleDto = (sysUserRoleDto: Recordable) => {
    return sessionStorage.setItem(Keys.SysUserRoleDto, JSON.stringify(sysUserRoleDto))
}
export const getUserId = () => {
    return sessionStorage.getItem(Keys.UserId)
}
export const getDeptCodeList = () => {
    return sessionStorage.getItem(Keys.DeptCodeList)
}
export const getSysUserRoleDto = () => {
    return sessionStorage.getItem(Keys.SysUserRoleDto)
}
//存储过期时间
export const setExpireTime = (time: number) => {
    sessionStorage.setItem(Keys.ExpireTime, JSON.stringify(time))
}
export const getExpireTime = () => {
    return sessionStorage.getItem(Keys.ExpireTime)
}
//session清空
export const cleanSession = () => {
    sessionStorage.clear()
}