This commit is contained in:
2026-04-22 20:14:15 +08:00
parent 0773a0d0ca
commit 0e9c286a57
205 changed files with 25790 additions and 1623 deletions

View File

@@ -0,0 +1,5 @@
export {
getPuzzleGalleryDetail,
listPuzzleGallery,
puzzleGalleryClient,
} from './puzzleGalleryClient';

View File

@@ -0,0 +1,49 @@
import type {
PuzzleWorksResponse,
PuzzleWorkSummary,
} from '../../../packages/shared/src/contracts/puzzleWorkSummary';
import { type ApiRetryOptions, requestJson } from '../apiClient';
const PUZZLE_GALLERY_API_BASE = '/api/runtime/puzzle/gallery';
const PUZZLE_GALLERY_READ_RETRY: ApiRetryOptions = {
maxRetries: 1,
baseDelayMs: 120,
maxDelayMs: 360,
};
/**
* 读取拼图广场列表。
*/
export async function listPuzzleGallery() {
return requestJson<PuzzleWorksResponse>(
PUZZLE_GALLERY_API_BASE,
{
method: 'GET',
},
'读取拼图广场失败',
{
retry: PUZZLE_GALLERY_READ_RETRY,
},
);
}
/**
* 读取拼图广场详情。
*/
export async function getPuzzleGalleryDetail(profileId: string) {
return requestJson<{ item: PuzzleWorkSummary }>(
`${PUZZLE_GALLERY_API_BASE}/${encodeURIComponent(profileId)}`,
{
method: 'GET',
},
'读取拼图广场详情失败',
{
retry: PUZZLE_GALLERY_READ_RETRY,
},
);
}
export const puzzleGalleryClient = {
getDetail: getPuzzleGalleryDetail,
list: listPuzzleGallery,
};