Commit 47b20be3 by 姜雷

Merge branch 'develop' into 'test'

token储存方式从cookie修改为sessionStorage See merge request !53
parents dfaf039b 1f72f026
import Cookies from 'js-cookie';
import { TOKEN_KEY } from '@/config/index'; import { TOKEN_KEY } from '@/config/index';
const TokenKey = TOKEN_KEY; const TokenKey = TOKEN_KEY;
export function getToken() { export function getToken() {
return Cookies.get(TokenKey); return sessionStorage.getItem(TokenKey);
} }
export function setToken(token, expires) { export function setToken(token, expires) {
return Cookies.set(TokenKey, token, { expires: expires }); return sessionStorage.setItem(TokenKey, token);
} }
export function removeToken() { 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