Files
JayuCloud/Frontend/src/api/user.ts
T

62 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-02-25 09:13:45 +08:00
import api from './index'
import type { UserInfo } from './auth'
2026-02-25 11:38:31 +08:00
export interface UserVO extends UserInfo {
id: number
shopId?: number
shopName?: string
nickname: string
account: string
avatar: string
signature?: string
level?: string
type: number
vipId?: number
createTime: string
updateTime: string
status: number
phone?: string
}
2026-02-25 09:13:45 +08:00
export interface UpdateUserInfoRequest {
nickname?: string
avatar?: string
signature?: string
}
2026-02-25 10:37:16 +08:00
export interface ListUsersParams {
page: number
size: number
keyword?: string
shopId?: number
2026-02-25 10:37:16 +08:00
}
export interface CreateUserRequest {
2026-02-25 11:38:31 +08:00
account: string
2026-02-25 10:37:16 +08:00
nickname: string
phone: string
password: string
2026-02-25 11:38:31 +08:00
type: number
shopId?: number
2026-02-25 10:37:16 +08:00
}
export interface UpdateUserRequest {
2026-02-25 11:38:31 +08:00
account?: string
2026-02-25 10:37:16 +08:00
nickname?: string
phone?: string
2026-02-25 11:38:31 +08:00
type?: number
shopId?: number
2026-02-25 10:37:16 +08:00
}
2026-02-25 09:13:45 +08:00
export const userApi = {
getUserInfo: () => {
return api.get<UserVO>('/user/info')
},
updateUserInfo: (data: UpdateUserInfoRequest) => {
return api.put('/user/info', data)
},
getUserByAccount: (account: string) => {
return api.get<UserVO>(`/user/get/account/${account}`)
2026-02-25 09:13:45 +08:00
}
}