import { dictypeData } from "@/api/user"

const accessTokenKey = 'cntoken'
const refreshTokenKey = 'cnrtoken'
const id = 'cnid'
const loginname = 'cnloginname'
const menuslist = 'menus'
const dicData = 'dictypeData'
const sys = 'sysData'
const user = 'Info'
const loginstatus = 'loginstatus'
export function getToken() {
    return window.sessionStorage.getItem(accessTokenKey)
}

export function setToken(token) {
    window.sessionStorage.setItem(accessTokenKey, token)
    window.localStorage.setItem(accessTokenKey, token)
}


export function getLoginStatus() {
    return window.sessionStorage.getItem(loginstatus)
}
export function setLoginStatus(loginStatus) {
    window.sessionStorage.setItem(loginstatus, loginStatus)
}
export function getLoginName() {
    window.sessionStorage.getItem(loginname)
}

export function setLoginName(loginName) {
    window.sessionStorage.setItem(loginname, loginName)
}
export function setMenus(menus) {
    window.sessionStorage.setItem(menuslist, menus)
}
export function setDictype(dictType) {
    window.localStorage.setItem(dicData, dictType)
}
export function setSysConfig(sysdata) {
    window.sessionStorage.setItem(sys, sysdata)
}
export function getMenus() {
    window.sessionStorage.getItem(menuslist)
}
export function getUserIndex() {
    window.sessionStorage.getItem(id)
}

export function setUserIndex(userIndex1) {
    window.sessionStorage.setItem(id, userIndex1)
}

export function removeToken() {
    return window.sessionStorage.removeItem(accessTokenKey)
}
export function appuserinfo() {
    return window.sessionStorage.removeItem('APP_USER_INFO')
}
export function setUserInfo(data) {
    window.sessionStorage.setItem(user, data)
}
export function getRefreshToken() {
    return window.sessionStorage.getItem(refreshTokenKey)
}

export function setRefreshToken(token) {
    window.sessionStorage.setItem(refreshTokenKey, token)
}

export function removeRefreshToken() {
    return window.sessionStorage.removeItem(refreshTokenKey)
}
export function removeClear() {
    return window.sessionStorage.clear()
}