diff --git a/app/api/search/route.ts b/app/api/search/route.ts index 8097583..5b2236e 100644 --- a/app/api/search/route.ts +++ b/app/api/search/route.ts @@ -17,6 +17,7 @@ import { const SEARCH = gql` query Search($queryInput: SearchQueryInput!) { search(queryInput: $queryInput) { + keywords torrents { hash name @@ -54,7 +55,10 @@ const schema = z.object({ sortType: z.enum(SEARCH_PARAMS.sortType).default(DEFAULT_SORT_TYPE), filterTime: z.enum(SEARCH_PARAMS.filterTime).default(DEFAULT_FILTER_TIME), filterSize: z.enum(SEARCH_PARAMS.filterSize).default(DEFAULT_FILTER_SIZE), - withTotalCount: z.coerce.boolean().default(false), + withTotalCount: z + .enum(["0", "1"]) + .transform((value) => value === "1") + .default("1"), }); const handler = async (request: Request) => { diff --git a/app/search/page.tsx b/app/search/page.tsx index a52221b..18c315b 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -63,8 +63,9 @@ async function fetchData({ filterSize !== cachedSearchOption.filterSize; if (isNewSearch) { - params.set("withTotalCount", "true"); cachedSearchOption = null; // Reset cachedSearchOption for new search + } else { + params.set("withTotalCount", "0"); } try {