feat(ux-26): implement real shop pagination with deep-link page support and regression test
This commit is contained in:
1 parent
92065cc7f2
commit
21f7768cce
3 files changed
+115
-22
No files matched your search
@@ -43,6 +43,8 @@ export default async function Shop({ searchParams }: { searchParams: Promise<{ [
|
||||
const symptomsParam = typeof resolvedParams.symptoms === 'string' ? resolvedParams.symptoms : "";
|
||||
const symptomSingle = typeof resolvedParams.symptom === 'string' ? resolvedParams.symptom : "";
|
||||
const symptoms = symptomsParam || (symptomSingle ? symptomSingle : "");
|
||||
const pageParam = typeof resolvedParams.page === "string" ? parseInt(resolvedParams.page, 10) : 1;
|
||||
const initialPage = isNaN(pageParam) || pageParam < 1 ? 1 : pageParam;
|
||||
const { data: initialProducts } = await productService.getProducts({ category, petType: petType as PetType | "all", query: search, symptom: symptomSingle, limit: 999 });
|
||||
|
||||
return (
|
||||
@@ -52,6 +54,7 @@ export default async function Shop({ searchParams }: { searchParams: Promise<{ [
|
||||
initialPetType={petType}
|
||||
initialSymptoms={symptoms}
|
||||
initialProducts={initialProducts}
|
||||
initialPage={initialPage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user