mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
code refactor
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
const tokenLocalStorageKey = 'lab_user_token';
|
||||
|
||||
function getToken() {
|
||||
return localStorage.getItem(tokenLocalStorageKey);
|
||||
}
|
||||
|
||||
function isUserLogined() {
|
||||
return !!getToken();
|
||||
}
|
||||
|
||||
function updateToken(token) {
|
||||
return localStorage.setItem(tokenLocalStorageKey, token);
|
||||
}
|
||||
|
||||
function clearToken() {
|
||||
return localStorage.removeItem(tokenLocalStorageKey);
|
||||
}
|
||||
|
||||
export default {
|
||||
getToken,
|
||||
isUserLogined,
|
||||
updateToken,
|
||||
clearToken
|
||||
};
|
||||
Reference in New Issue
Block a user