/* code */
// eslint-disable-next-line prefer-const
export let CODE401 = 5000 // 没有权限
export const CODE_ERR_CANCELED = "ERR_CANCELED" // 取消请求的code
export function setCODE401(code: number) {
  CODE401 = code
}

/** cookie */
const TokenKey = "ppt-Token"

export let TokenInvalidFlag = true // 令牌是否有效
export function getToken() {
  return sessionStorage.getItem(TokenKey)
}

export function setToken(token: string) {
  TokenInvalidFlag = true
  return sessionStorage.setItem(TokenKey, token)
}

export function removeToken() {
  TokenInvalidFlag = false
  sessionStorage.removeItem(TokenKey)
}
