From 3b82602c381933d32b42363f9b890651488dd2d0 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Fri, 24 Apr 2026 08:55:48 +0800 Subject: [PATCH] fix(api): align list defaults with backend page limits --- lib/api/chat.ts | 2 +- lib/api/comments.ts | 2 +- lib/api/disputes.ts | 2 +- lib/api/games.ts | 2 +- lib/api/orders.ts | 2 +- lib/api/players.ts | 4 ++-- lib/api/posts.ts | 2 +- lib/api/reviews.ts | 2 +- lib/api/shops.ts | 2 +- lib/api/transactions.ts | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/api/chat.ts b/lib/api/chat.ts index b5d8517..9228d39 100644 --- a/lib/api/chat.ts +++ b/lib/api/chat.ts @@ -25,7 +25,7 @@ export type ListChatMessagesOptions = { function withOffsetLimit(path: string, options?: { offset?: number; limit?: number }): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), diff --git a/lib/api/comments.ts b/lib/api/comments.ts index 85c087b..fc41f9c 100644 --- a/lib/api/comments.ts +++ b/lib/api/comments.ts @@ -20,7 +20,7 @@ type ListOptions = { function withOffsetLimit(path: string, options?: ListOptions): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), limit: String(limit), diff --git a/lib/api/disputes.ts b/lib/api/disputes.ts index 79e4f27..3a7f0c1 100644 --- a/lib/api/disputes.ts +++ b/lib/api/disputes.ts @@ -34,7 +34,7 @@ type Paginated = { function withOffsetLimit(path: string, options?: ListDisputesOptions): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), diff --git a/lib/api/games.ts b/lib/api/games.ts index 80e9edf..349080d 100644 --- a/lib/api/games.ts +++ b/lib/api/games.ts @@ -13,7 +13,7 @@ type Paginated = { } export async function listGames(): Promise { - const res = await httpJson>("/api/v1/games?offset=0&limit=1000", { + const res = await httpJson>("/api/v1/games?offset=0&limit=100", { cache: "no-store", }) return res.items diff --git a/lib/api/orders.ts b/lib/api/orders.ts index 1378d3c..cd68dee 100644 --- a/lib/api/orders.ts +++ b/lib/api/orders.ts @@ -24,7 +24,7 @@ type ActionResult = { decision: ApiDecision; order?: Order } function withOffsetLimit(path: string, options?: ListOrdersOptions): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), diff --git a/lib/api/players.ts b/lib/api/players.ts index 64adb44..15b5f80 100644 --- a/lib/api/players.ts +++ b/lib/api/players.ts @@ -13,7 +13,7 @@ type Paginated = { } export async function listPlayers(): Promise { - const res = await httpJson>("/api/v1/players?offset=0&limit=1000", { + const res = await httpJson>("/api/v1/players?offset=0&limit=100", { cache: "no-store", }) return res.items @@ -37,7 +37,7 @@ export async function getPlayerById(playerId: string): Promise { const res = await httpJson>( - `/api/v1/shops/${encodeURIComponent(shopId)}/players?offset=0&limit=1000`, + `/api/v1/shops/${encodeURIComponent(shopId)}/players?offset=0&limit=100`, { cache: "no-store" }, ) return res.items diff --git a/lib/api/posts.ts b/lib/api/posts.ts index 9aa2ec1..cd30bd5 100644 --- a/lib/api/posts.ts +++ b/lib/api/posts.ts @@ -19,7 +19,7 @@ type ListOptions = { function withOffsetLimit(path: string, options?: ListOptions): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), diff --git a/lib/api/reviews.ts b/lib/api/reviews.ts index e989f87..faa199d 100644 --- a/lib/api/reviews.ts +++ b/lib/api/reviews.ts @@ -20,7 +20,7 @@ export type ListReviewsOptions = { function withOffsetLimit(path: string, options?: ListReviewsOptions): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), diff --git a/lib/api/shops.ts b/lib/api/shops.ts index 1e8e768..5e2fdd9 100644 --- a/lib/api/shops.ts +++ b/lib/api/shops.ts @@ -13,7 +13,7 @@ type Paginated = { } export async function listShops(): Promise { - const res = await httpJson>("/api/v1/shops?offset=0&limit=1000", { + const res = await httpJson>("/api/v1/shops?offset=0&limit=100", { cache: "no-store", }) return res.items diff --git a/lib/api/transactions.ts b/lib/api/transactions.ts index 0503e62..d1a3d94 100644 --- a/lib/api/transactions.ts +++ b/lib/api/transactions.ts @@ -18,7 +18,7 @@ export type ListWalletTransactionsOptions = { function withOffsetLimit(path: string, options?: ListWalletTransactionsOptions): string { const offset = options?.offset ?? 0 - const limit = options?.limit ?? 1000 + const limit = options?.limit ?? 100 const searchParams = new URLSearchParams({ offset: String(offset), limit: String(limit),