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

- 移除所有语句末尾分号
- 统一对象属性尾随逗号格式
- 优化类型定义导入顺序
- 提升代码一致性和可读性
This commit is contained in:
ianshaw
2025-12-25 08:41:30 -08:00
parent 34183b527b
commit f79b0f0fad
21 changed files with 802 additions and 751 deletions

View File

@@ -2,31 +2,31 @@
* System API endpoints for admin operations
*/
import { apiClient } from '../client';
import { apiClient } from '../client'
export interface ReleaseInfo {
name: string;
body: string;
published_at: string;
html_url: string;
name: string
body: string
published_at: string
html_url: string
}
export interface VersionInfo {
current_version: string;
latest_version: string;
has_update: boolean;
release_info?: ReleaseInfo;
cached: boolean;
warning?: string;
build_type: string; // "source" for manual builds, "release" for CI builds
current_version: string
latest_version: string
has_update: boolean
release_info?: ReleaseInfo
cached: boolean
warning?: string
build_type: string // "source" for manual builds, "release" for CI builds
}
/**
* Get current version
*/
export async function getVersion(): Promise<{ version: string }> {
const { data } = await apiClient.get<{ version: string }>('/admin/system/version');
return data;
const { data } = await apiClient.get<{ version: string }>('/admin/system/version')
return data
}
/**
@@ -35,14 +35,14 @@ export async function getVersion(): Promise<{ version: string }> {
*/
export async function checkUpdates(force = false): Promise<VersionInfo> {
const { data } = await apiClient.get<VersionInfo>('/admin/system/check-updates', {
params: force ? { force: 'true' } : undefined,
});
return data;
params: force ? { force: 'true' } : undefined
})
return data
}
export interface UpdateResult {
message: string;
need_restart: boolean;
message: string
need_restart: boolean
}
/**
@@ -50,24 +50,24 @@ export interface UpdateResult {
* Downloads and applies the latest version
*/
export async function performUpdate(): Promise<UpdateResult> {
const { data } = await apiClient.post<UpdateResult>('/admin/system/update');
return data;
const { data } = await apiClient.post<UpdateResult>('/admin/system/update')
return data
}
/**
* Rollback to previous version
*/
export async function rollback(): Promise<UpdateResult> {
const { data } = await apiClient.post<UpdateResult>('/admin/system/rollback');
return data;
const { data } = await apiClient.post<UpdateResult>('/admin/system/rollback')
return data
}
/**
* Restart the service
*/
export async function restartService(): Promise<{ message: string }> {
const { data } = await apiClient.post<{ message: string }>('/admin/system/restart');
return data;
const { data } = await apiClient.post<{ message: string }>('/admin/system/restart')
return data
}
export const systemAPI = {
@@ -75,7 +75,7 @@ export const systemAPI = {
checkUpdates,
performUpdate,
rollback,
restartService,
};
restartService
}
export default systemAPI;
export default systemAPI