From edbe2964e959a334e1d9e12717bf854d89d25c92 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 15 六月 2022 21:01:26 +0800
Subject: [PATCH] 1.cookie带到接口上

---
 src/utils/auth.js |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/utils/auth.js b/src/utils/auth.js
index e9bdf27..6249c38 100644
--- a/src/utils/auth.js
+++ b/src/utils/auth.js
@@ -14,32 +14,32 @@
   return Cookies.remove(TokenKey)
 }
 
-export function getCookie(c_name) {
+export function getCookie(key) {
   // 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)
+  // 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) {
-  var date = new Date()
-  date.setSeconds(date.getSeconds() + 10000)
-  document.cookie = key + '=' + escape(value) + '; expires=' + date.toGMTString() + ';path=/'
+  // var date = new Date()
+  // date.setSeconds(date.getSeconds() + 10000)
+  // document.cookie = key + '=' + escape(value) + '; expires=' + date.toGMTString() + ';path=/'
 
-  // return Cookies.set(key, value)
+  return Cookies.set(key, value)
 }
 
 export function removeCookie(key) {
-  setCookie(key, '', -1)
-  // return Cookies.remove(key)
+  // setCookie(key, '', -1)
+  return Cookies.remove(key)
 }

--
Gitblit v1.9.3