Commit f79b0f0f authored by ianshaw's avatar ianshaw
Browse files

style(frontend): 统一 API 模块代码风格

- 移除所有语句末尾分号
- 统一对象属性尾随逗号格式
- 优化类型定义导入顺序
- 提升代码一致性和可读性
parent 34183b52
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
* Handles user profile management and password changes * Handles user profile management and password changes
*/ */
import { apiClient } from './client'; import { apiClient } from './client'
import type { User, ChangePasswordRequest } from '@/types'; import type { User, ChangePasswordRequest } from '@/types'
/** /**
* Get current user profile * Get current user profile
* @returns User profile data * @returns User profile data
*/ */
export async function getProfile(): Promise<User> { export async function getProfile(): Promise<User> {
const { data } = await apiClient.get<User>('/user/profile'); const { data } = await apiClient.get<User>('/user/profile')
return data; return data
} }
/** /**
...@@ -21,11 +21,11 @@ export async function getProfile(): Promise<User> { ...@@ -21,11 +21,11 @@ export async function getProfile(): Promise<User> {
* @returns Updated user profile data * @returns Updated user profile data
*/ */
export async function updateProfile(profile: { export async function updateProfile(profile: {
username?: string; username?: string
wechat?: string; wechat?: string
}): Promise<User> { }): Promise<User> {
const { data } = await apiClient.put<User>('/user', profile); const { data } = await apiClient.put<User>('/user', profile)
return data; return data
} }
/** /**
...@@ -39,17 +39,17 @@ export async function changePassword( ...@@ -39,17 +39,17 @@ export async function changePassword(
): Promise<{ message: string }> { ): Promise<{ message: string }> {
const payload: ChangePasswordRequest = { const payload: ChangePasswordRequest = {
old_password: oldPassword, old_password: oldPassword,
new_password: newPassword, new_password: newPassword
}; }
const { data } = await apiClient.put<{ message: string }>('/user/password', payload); const { data } = await apiClient.put<{ message: string }>('/user/password', payload)
return data; return data
} }
export const userAPI = { export const userAPI = {
getProfile, getProfile,
updateProfile, updateProfile,
changePassword, changePassword
}; }
export default userAPI; export default userAPI
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment