import Cookies from 'js-cookie'

const TokenKey = 'bwgzl_token'
const UserInfoKey = 'bwgzl_user_info'

export function getToken() {  
  console.log('刷新后getToken',Cookies.get(TokenKey));
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token, { sameSite: 'None', secure: true })
}

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

export function getUserInfo() {
  console.log('刷新后getUserInfo',JSON.parse(localStorage.getItem(UserInfoKey)));
  return JSON.parse(localStorage.getItem(UserInfoKey))
}

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

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