import Cookies from 'js-cookie'

const TokenKey = 'X-JZ-Admin-Token'

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

export function setToken(token,type=0) {
  if (type === 1) {
    Cookies.set("login", true, { expires: 7 });
  }
  Cookies.set(TokenKey,token , { expires: 7 })
}

export function removeToken() {
  localStorage.removeItem('userInfo')
  Cookies.remove('login')
  Cookies.remove(TokenKey)
}

export function getLoginStatus() {
  return Cookies.get('login')
}
