shop-wx/src/api/users/index.ts

12 lines
416 B
TypeScript
Raw Normal View History

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));
}