阶段七:完成CardList React feature化与批量追加边界
This commit is contained in:
1 parent
03f108639d
commit
66ac84b32d
18 files changed
+1105
-975
No files matched your search
@@ -448,8 +448,8 @@ const cardPayload = (data: Partial<Card>): Record<string, unknown> => ({
|
||||
api_config: data.api_config ? JSON.stringify(data.api_config) : '',
|
||||
});
|
||||
|
||||
export const getCards = async (): Promise<Card[]> => {
|
||||
const res = await get<Card[] | CardListResponse>('/api/v1/cards');
|
||||
export const getCards = async (options?: RequestControlOptions): Promise<Card[]> => {
|
||||
const res = await get<Card[] | CardListResponse>('/api/v1/cards', undefined, options);
|
||||
const cards = Array.isArray(res) ? res : (res.cards || []);
|
||||
return cards.map(normalizeCard);
|
||||
};
|
||||
@@ -472,7 +472,7 @@ export const getCardDetails = async (cardId: string | number): Promise<Card> =>
|
||||
};
|
||||
|
||||
// 批量创建卡密组(上传表格)
|
||||
export const batchCreateCards = async (file: File): Promise<CardBatchResponse> => {
|
||||
export const batchCreateCards = async (file: File, options?: RequestControlOptions): Promise<CardBatchResponse> => {
|
||||
// 批量创建接口返回总行数、成功数、失败数和逐行结果。
|
||||
// CardBatchResponse 保留旧字段名称,调用方无需转换统计字段。
|
||||
// rows 中的 id 只在创建成功时返回。
|
||||
@@ -481,12 +481,12 @@ export const batchCreateCards = async (file: File): Promise<CardBatchResponse> =
|
||||
// 此处只收紧 TypeScript 响应契约。
|
||||
const body = new FormData();
|
||||
body.append('file', file);
|
||||
return postForm('/api/v1/cards/batch', body);
|
||||
return postForm('/api/v1/cards/batch', body, options);
|
||||
};
|
||||
|
||||
// 往 data 类型卡密组批量追加卡密号
|
||||
export const appendCardData = async (cardId: string | number, content: string): Promise<CardAppendResponse> => {
|
||||
return post(`/api/v1/cards/${cardId}/append-data`, { content });
|
||||
export const appendCardData = async (cardId: string | number, content: string, options?: RequestControlOptions): Promise<CardAppendResponse> => {
|
||||
return post(`/api/v1/cards/${cardId}/append-data`, { content }, options);
|
||||
};
|
||||
|
||||
// Items
|
||||
|
||||
Reference in new issue
Block a user