import Cookies from 'js-cookie'

const TokenKey = 'dongtuo_token'
const TokenKey_h5 = 'dongtuo_token_h5'
export function getToken() {
  let flag = /\/h5.*/.test(window.location.href)
  return Cookies.get(flag ? TokenKey_h5 : TokenKey)
}

export function setToken(token) {
  let flag = /\/h5.*/.test(window.location.href)
  return Cookies.set(flag ? TokenKey_h5 : TokenKey, token)
}

export function removeToken() {
  let flag = /\/h5.*/.test(window.location.href)
  return Cookies.remove(flag ? TokenKey_h5 : TokenKey)
}
