mirror of
https://github.com/1024-lab/smart-admin.git
synced 2026-06-02 03:55:59 +00:00
v2.0代码提交
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import Cookies from 'js-cookie';
|
||||
import config from '@/config';
|
||||
const { cookieExpires } = config;
|
||||
export const TOKEN_KEY = 'token';
|
||||
|
||||
export default {
|
||||
setToken: token => {
|
||||
Cookies.set(TOKEN_KEY, token, {
|
||||
// token在Cookie中存储的天数,默认1天
|
||||
expires: cookieExpires || 7
|
||||
});
|
||||
},
|
||||
getToken: () => {
|
||||
const token = Cookies.get(TOKEN_KEY);
|
||||
if (token) return token;
|
||||
else return null;
|
||||
},
|
||||
clearToken: () => {
|
||||
Cookies.remove(TOKEN_KEY);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user