提交 8e2bda07 authored 作者: 钟是志's avatar 钟是志

setToken方法修改

上级 14fe12b9
import { getCookie, setCookie, delCookie } from "./cookie"; import { getCookie, setCookie, delCookie } from './cookie';
/** /**
* 设置token * 设置token
* */ * */
export const setToken = (value, time) => localStorage.setItem("antd-pro-token-onestop", value); export const setToken = (value, time) => localStorage.setItem('antd-pro-token-onestop', value);
/** /**
* 获取token * 获取token
* */ * */
export const getToken = () => { export const getToken = () => {
const x = localStorage.getItem("antd-pro-token-onestop"); const x = localStorage.getItem('antd-pro-token-onestop');
if (x && x.length > 11) { if (x && x.length > 11) {
return x; return x;
} }
const y = localStorage.getItem("antd-pro-token"); const y = localStorage.getItem('antd-pro-token');
if (y && y.length > 11) { if (y && y.length > 11) {
return y; return y;
} }
...@@ -24,4 +24,4 @@ export const getToken = () => { ...@@ -24,4 +24,4 @@ export const getToken = () => {
/** /**
* 删除token * 删除token
* */ * */
export const delToken = () => localStorage.removeItem("antd-pro-token-onestop"); export const delToken = () => localStorage.removeItem('antd-pro-token-onestop');
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论