优化列表分页和数据加载
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import api from './client';
|
||||
import type {
|
||||
BasicSummary,
|
||||
HuyaAccountItem,
|
||||
HuyaAccountSummary,
|
||||
HuyaAutoRegisterBatch,
|
||||
HuyaAutoRegisterRequest,
|
||||
HuyaAutoRegisterRetryRequest,
|
||||
@@ -25,12 +27,17 @@ import type {
|
||||
MessageCountResponse,
|
||||
MessageDeletedResponse,
|
||||
MessageResponse,
|
||||
PageParams,
|
||||
PaginatedResponse,
|
||||
} from './types';
|
||||
|
||||
export const huyaApi = {
|
||||
taskTypes: () => api.get<Record<string, string>, Record<string, string>>('/huya/task-types'),
|
||||
listAccounts: (params?: { assigned_only?: boolean; tag?: string; has_cookie?: boolean }) =>
|
||||
listAccounts: (params?: { assigned_only?: boolean; tag?: string; has_cookie?: boolean; include_cookie?: boolean }) =>
|
||||
api.get<HuyaAccountItem[], HuyaAccountItem[]>('/huya/accounts', { params }),
|
||||
listAccountsPaged: (params: PageParams & { assigned_only?: boolean; tag?: string; has_cookie?: boolean; include_cookie?: boolean }) =>
|
||||
api.get<PaginatedResponse<HuyaAccountItem>, PaginatedResponse<HuyaAccountItem>>('/huya/accounts', { params }),
|
||||
accountsSummary: () => api.get<HuyaAccountSummary, HuyaAccountSummary>('/huya/accounts/summary'),
|
||||
importCookies: (text: string, tag: string = '') =>
|
||||
api.post<HuyaCookieImportResult, HuyaCookieImportResult>('/huya/accounts/import-cookies', { text, tag }),
|
||||
importPasswordAccounts: (text: string, tag: string = '') =>
|
||||
@@ -76,6 +83,10 @@ export const huyaApi = {
|
||||
deleteAccounts: (accountIds: number[]) =>
|
||||
api.delete<MessageDeletedResponse, MessageDeletedResponse>('/huya/accounts/batch', { params: { account_ids: accountIds.join(',') } }),
|
||||
listCookies: () => api.get<HuyaCookieItem[], HuyaCookieItem[]>('/huya/cookies'),
|
||||
listCookiesPaged: (params: PageParams & { include_cookie?: boolean }) =>
|
||||
api.get<PaginatedResponse<HuyaCookieItem>, PaginatedResponse<HuyaCookieItem>>('/huya/cookies', { params }),
|
||||
cookiesSummary: () => api.get<BasicSummary, BasicSummary>('/huya/cookies/summary'),
|
||||
getCookie: (id: number) => api.get<HuyaCookieItem, HuyaCookieItem>(`/huya/cookies/${id}`),
|
||||
exportCookies: (format?: string) => api.get<Blob, Blob>('/huya/cookies/export', { responseType: 'blob', params: format ? { format } : {} }),
|
||||
deleteCookie: (id: number) => api.delete<MessageResponse, MessageResponse>(`/huya/cookies/${id}`),
|
||||
deleteCookies: (accountIds: number[]) =>
|
||||
|
||||
Reference in New Issue
Block a user