import Cookies from 'js-cookie'

const TokenKey = 'exhibition_token'
const UserInfoKey = 'exhibition_userInfo'
const MenuKey = 'exhibition_menu'

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

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

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

export function setUserInfo(userInfo) {
  return localStorage.setItem(UserInfoKey, JSON.stringify(userInfo))
}

export function getUserInfo() {
  return JSON.parse(localStorage.getItem(UserInfoKey))
}

export function removeUserInfo() {
  localStorage.removeItem(UserInfoKey)
}

export function setLocalMenu(menu) {
  return localStorage.setItem(MenuKey, JSON.stringify(menu))
}


export function getLocalMenu() {
  return JSON.parse(localStorage.getItem(MenuKey))
}

export function removeLocalMenu() {
  localStorage.removeItem(MenuKey)
}
