12 lines
416 B
TypeScript
12 lines
416 B
TypeScript
|
|
import { http } from "@/http/http";
|
||
|
|
import type { ApiResult } from '@/api';
|
||
|
|
import type { CurrentUserResponseData } from './types';
|
||
|
|
|
||
|
|
/** 获取当前登录用户详情 */
|
||
|
|
export async function getCurrentUserApi() {
|
||
|
|
const res: any = await http.get<ApiResult<CurrentUserResponseData>>("users/me");
|
||
|
|
if (res.data.state === 'ok') {
|
||
|
|
return res.data.data;
|
||
|
|
}
|
||
|
|
return Promise.reject(new Error(res.data.message));
|
||
|
|
}
|