12345678910111213141516171819202122232425262728 |
- import { localStg } from '@/utils';
- /** 获取token */
- export function getToken() {
- return localStorage.getItem('token');
- }
- /** 获取用户信息 */
- export function getUserInfo() {
- const emptyInfo: Auth.UserInfo = {
- id: null,
- username: '',
- phone: null,
- email: '',
- permissions: [],
- departments: [],
- userType: ''
- };
- const userInfo: Auth.UserInfo = localStg.get('userInfo') || emptyInfo;
- return userInfo;
- }
- /** 去除用户相关缓存 */
- export function clearAuthStorage() {
- localStg.remove('token');
- localStg.remove('refreshToken');
- localStg.remove('userInfo');
- }
|