提交 2b4bb632 authored 作者: 钟是志's avatar 钟是志

getToken方法使用一站式的.

上级 849e3c18
import { getCookie, setCookie, delCookie } from './cookie';
import { getCookie, setCookie, delCookie } from "./cookie";
/**
* 设置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
* */
export const getToken = () => {
const x = localStorage.getItem('antd-pro-token-onestop');
if (x != null && (x == 'null' || x == 'undefined')) {
return null;
}
return x;
const x = localStorage.getItem("antd-pro-token-onestop");
if (x && x.length > 11) {
return x;
}
const y = localStorage.getItem("antd-pro-token");
if (y && y.length > 11) {
return y;
}
return null;
};
/**
* 删除token
* */
export const delToken = () => localStorage.removeItem('antd-pro-token-onestop');
export const delToken = () => localStorage.removeItem("antd-pro-token-onestop");
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论