This commit is contained in:
5
src/services/puzzle-gallery/index.ts
Normal file
5
src/services/puzzle-gallery/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export {
|
||||
getPuzzleGalleryDetail,
|
||||
listPuzzleGallery,
|
||||
puzzleGalleryClient,
|
||||
} from './puzzleGalleryClient';
|
||||
49
src/services/puzzle-gallery/puzzleGalleryClient.ts
Normal file
49
src/services/puzzle-gallery/puzzleGalleryClient.ts
Normal 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,
|
||||
};
|
||||
Reference in New Issue
Block a user