Commit 1f72f026 by 姜雷

token储存方式从cookie修改为sessionStorage

parent f05a245f
import Cookies from 'js-cookie';
import { TOKEN_KEY } from '@/config/index';
const TokenKey = TOKEN_KEY;
export function getToken() {
return Cookies.get(TokenKey);
return sessionStorage.getItem(TokenKey);
}
export function setToken(token, expires) {
return Cookies.set(TokenKey, token, { expires: expires });
return sessionStorage.setItem(TokenKey, token);
}
export function removeToken() {
return Cookies.remove(TOKEN_KEY);
return sessionStorage.removeItem(TOKEN_KEY);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment