loulijun2021
2022-06-15 8e51e2713e358aade30db570b0cb8a4877022cf9
src/utils/auth.js
@@ -14,14 +14,32 @@
  return Cookies.remove(TokenKey)
}
export function getCookie(key) {
  return Cookies.get(key)
export function getCookie(c_name) {
  // document.cookie = escape(key) + ';path=/'
  if (document.cookie.length > 0) {
    let c_start = document.cookie.indexOf(c_name + '=')
    if (c_start != -1) {
      c_start = c_start + c_name.length + 1
      let c_end = document.cookie.indexOf(';', c_start)
      if (c_end == -1) {
        c_end = document.cookie.length
      }
      return unescape(document.cookie.substring(c_start, c_end))
    }
  }
  return ''
  // return Cookies.get(key)
}
export function setCookie(key, value) {
  return Cookies.set(key, value)
  var date = new Date()
  date.setSeconds(date.getSeconds() + 10000)
  document.cookie = key + '=' + escape(value) + '; expires=' + date.toGMTString() + ';path=/'
  // return Cookies.set(key, value)
}
export function removeCookie(key) {
  return Cookies.remove(key)
  setCookie(key, '', -1)
  // return Cookies.remove(key)
}