first1
This commit is contained in:
19
src/api/user.ts
Normal file
19
src/api/user.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// 用户资料接口(真实后端绑定)
|
||||
// 后端:org.dromara.system.controller.system.SysUserController#profile → /system/user/profile
|
||||
// 鉴权:需登录态
|
||||
import { request } from '@/utils/request'
|
||||
import type { UserProfileVo } from '@/types/business/user'
|
||||
|
||||
/**
|
||||
* 当前登录用户资料(需求提报页预填联系人姓名 / 电话)。
|
||||
*
|
||||
* <p>⚠️ 后端返回的是 `R<Map>`,用户对象嵌在 **`data.user`** 里(同级还有 roles / posts),
|
||||
* 不是平铺在 data 上——这里在 api 层解包,调用方拿到的是用户对象本身。</p>
|
||||
*/
|
||||
export async function getUserProfile(): Promise<UserProfileVo> {
|
||||
const data = await request<{ user: UserProfileVo }>({
|
||||
url: '/system/user/profile',
|
||||
method: 'get',
|
||||
})
|
||||
return data.user
|
||||
}
|
||||
Reference in New Issue
Block a user