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) {