/*
 * @FilePath     : /src/utils/auth.js
 * @Description  : 登录凭证存取
 */
import Cookies from 'js-cookie'

const sessionTokenKey = 'Admin-Token'
const cookieTokenKey = 'JSESSIONID'

export function cookieGetToken() {
  return Cookies.get(cookieTokenKey)
}

export function cookieSetToken(token) {
  return Cookies.set(cookieTokenKey, token, { expires: 302 })
}

export function cookieRemoveToken() {
  sessionStorage.clear()
  return Cookies.remove(cookieTokenKey)
}

export function getToken() {
  return sessionStorage.getItem(sessionTokenKey)
}

export function setToken(token) {
  return sessionStorage.setItem(sessionTokenKey, token)
}

export function removeToken() {
  return sessionStorage.clear()
}
