import Cookies from 'js-cookie';

export const TokenKey = 'Future_AI_token'

export function getToken() {
  // return Cookies.get(TokenKey)
  return getSession(TokenKey)
}

export function setToken(token) {
  // return Cookies.set(TokenKey, token)
  return setSession(TokenKey, token)
}

export function removeToken() {
  // return Cookies.remove(TokenKey)
  return removeSession(TokenKey)
}

// sesstionStorage相关
export function getSession(sessionKey) {
  return sessionStorage.getItem(sessionKey)
}

export function setSession(sessionKey, data) {
  return sessionStorage.setItem(sessionKey, data)
}

export function removeSession(sessionKey) {
  return sessionStorage.removeItem(sessionKey)
}

// localStorage相关
export function getLocal(sessionKey) {
  return localStorage.getItem(sessionKey)
}

export function setLocal(sessionKey, data) {
  return localStorage.setItem(sessionKey, data)
}

export function removeLocal(sessionKey) {
  return localStorage.removeItem(sessionKey)
}

// cookie相关

export function getCookie(key) {
  return Cookies.get(key)
}

export function setCookie(key, val) {
  return Cookies.set(key, val)
}

export function removeCookie(key) {
  return Cookies.remove(key)
}
