From 87efb72ff237283c903c77272925483d0c6f1683 Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Fri, 2 May 2025 12:49:58 +0000 Subject: [PATCH] Merged in fix/LOY-235-repeated-stays-when-clicking-show-more (pull request #1926) fix(LOY-235): update pagination params for getPreviousStays and getUpcomingStays * fix(LOY-235): update pagination parameters for getPreviousStays and getUpcomingStays functions Approved-by: Erik Tiekstra --- apps/scandic-web/server/routers/user/utils.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/scandic-web/server/routers/user/utils.ts b/apps/scandic-web/server/routers/user/utils.ts index fc0b67468..263872157 100644 --- a/apps/scandic-web/server/routers/user/utils.ts +++ b/apps/scandic-web/server/routers/user/utils.ts @@ -124,6 +124,12 @@ export async function getPreviousStays( metricsGetPreviousStays.start() + const params: Record = { limit: String(limit) } + + if (cursor) { + params.offset = cursor + } + const apiResponse = await api.get( api.endpoints.v1.Booking.Stays.past, { @@ -131,10 +137,7 @@ export async function getPreviousStays( Authorization: `Bearer ${accessToken}`, }, }, - { - limit, - cursor, - } + params ) if (!apiResponse.ok) { @@ -168,6 +171,12 @@ export async function getUpcomingStays( metricsGetUpcomingStays.start() + const params: Record = { limit: String(limit) } + + if (cursor) { + params.offset = cursor + } + const apiResponse = await api.get( api.endpoints.v1.Booking.Stays.future, { @@ -175,10 +184,7 @@ export async function getUpcomingStays( Authorization: `Bearer ${accessToken}`, }, }, - { - limit, - cursor, - } + params ) if (!apiResponse.ok) {