mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 1.0 beta
This commit is contained in:
31
src/store/modules/auth/shared.ts
Normal file
31
src/store/modules/auth/shared.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { localStg } from '@/utils/storage';
|
||||
|
||||
/**
|
||||
* get token
|
||||
*/
|
||||
export function getToken() {
|
||||
return localStg.get('token') || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* get user info
|
||||
*/
|
||||
export function getUserInfo() {
|
||||
const emptyInfo: Api.Auth.UserInfo = {
|
||||
userId: '',
|
||||
userName: '',
|
||||
roles: []
|
||||
};
|
||||
const userInfo = localStg.get('userInfo') || emptyInfo;
|
||||
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* clear auth storage
|
||||
*/
|
||||
export function clearAuthStorage() {
|
||||
localStg.remove('token');
|
||||
localStg.remove('refreshToken');
|
||||
localStg.remove('userInfo');
|
||||
}
|
Reference in New Issue
Block a user