Merge PR #15: feat: 增强用户管理功能,添加用户名、微信号和备注字段

This commit is contained in:
shaw
2025-12-23 14:03:07 +08:00
13 changed files with 401 additions and 21 deletions

View File

@@ -11,7 +11,20 @@ import type { User, ChangePasswordRequest } from '@/types';
* @returns User profile data
*/
export async function getProfile(): Promise<User> {
const { data } = await apiClient.get<User>('/users/me');
const { data } = await apiClient.get<User>('/user/profile');
return data;
}
/**
* Update current user profile
* @param profile - Profile data to update
* @returns Updated user profile data
*/
export async function updateProfile(profile: {
username?: string;
wechat?: string;
}): Promise<User> {
const { data } = await apiClient.put<User>('/user', profile);
return data;
}
@@ -29,12 +42,13 @@ export async function changePassword(
new_password: newPassword,
};
const { data } = await apiClient.post<{ message: string }>('/users/me/password', payload);
const { data } = await apiClient.put<{ message: string }>('/user/password', payload);
return data;
}
export const userAPI = {
getProfile,
updateProfile,
changePassword,
};