Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
f79b0f0f
Commit
f79b0f0f
authored
Dec 25, 2025
by
ianshaw
Browse files
style(frontend): 统一 API 模块代码风格
- 移除所有语句末尾分号 - 统一对象属性尾随逗号格式 - 优化类型定义导入顺序 - 提升代码一致性和可读性
parent
34183b52
Changes
21
Hide whitespace changes
Inline
Side-by-side
frontend/src/api/user.ts
View file @
f79b0f0f
...
@@ -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
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment