| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-01-21 21:12:52 |
| 4 | * @LastEditTime: 2025-02-21 21:13:19 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: |
| 7 | */ |
| 8 | import { store } from '../../global/store'; |
| 9 | import { IUserStore } from '@/store/user'; |
| 10 | import { IUserInfo } from '@/api/types/user-t'; |
| 11 | import { StoreKey } from '../../../src/utils/StroeEnum'; |
| 12 | |
| 13 | // 完整的响应数据接口 |
| 14 | interface ResponseData { |
| 15 | state: IUserStore; |
| 16 | version: number; |
| 17 | } |
| 18 | |
| 19 | export function getUserInfo(): IUserInfo { |
| 20 | const res: ResponseData = JSON.parse(store.get(StoreKey.User)); |
| 21 | return res.state.userInfo!; |
| 22 | } |
| 23 | |
| 24 | export function getUserToken() { |
| 25 | const res: ResponseData = JSON.parse(store.get(StoreKey.User)); |
| 26 | return res.state.token; |
| 27 | } |
| 28 |