chore: sync local latest state and repository cleanup
This commit is contained in:
@@ -49,6 +49,13 @@ export class MosquitoError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ShortenResponse {
|
||||
code: string
|
||||
path: string
|
||||
originalUrl: string
|
||||
trackingId?: string
|
||||
}
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
code: number
|
||||
message: string
|
||||
@@ -182,7 +189,15 @@ export class EnhancedApiClient {
|
||||
}
|
||||
|
||||
async getActivities(): Promise<any[]> {
|
||||
return this.requestData('/api/v1/activities')
|
||||
const response = await this.requestData<any>('/api/v1/activities')
|
||||
// 兼容分页响应 (content 字段) 和数组响应
|
||||
if (response && typeof response === 'object' && 'content' in response) {
|
||||
return response.content || []
|
||||
}
|
||||
if (Array.isArray(response)) {
|
||||
return response
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
async createActivity(data: any): Promise<any> {
|
||||
@@ -196,14 +211,14 @@ export class EnhancedApiClient {
|
||||
return this.requestData(`/api/v1/activities/${activityId}/stats`)
|
||||
}
|
||||
|
||||
async getShareUrl(activityId: number, userId: number, template?: string): Promise<string> {
|
||||
async getShareUrl(activityId: number, userId: number, template?: string): Promise<ShortenResponse> {
|
||||
const params = new URLSearchParams({
|
||||
activityId: activityId.toString(),
|
||||
userId: userId.toString(),
|
||||
...(template && { template }),
|
||||
})
|
||||
|
||||
return this.requestData(`/api/v1/me/share-url?${params}`)
|
||||
|
||||
return this.requestData<ShortenResponse>(`/api/v1/me/share-url?${params}`)
|
||||
}
|
||||
|
||||
async getPosterImage(activityId: number, userId: number, template?: string): Promise<Blob> {
|
||||
|
||||
Reference in New Issue
Block a user