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
This commit is contained in:
@@ -124,6 +124,12 @@ export async function getPreviousStays(
|
|||||||
|
|
||||||
metricsGetPreviousStays.start()
|
metricsGetPreviousStays.start()
|
||||||
|
|
||||||
|
const params: Record<string, string> = { limit: String(limit) }
|
||||||
|
|
||||||
|
if (cursor) {
|
||||||
|
params.offset = cursor
|
||||||
|
}
|
||||||
|
|
||||||
const apiResponse = await api.get(
|
const apiResponse = await api.get(
|
||||||
api.endpoints.v1.Booking.Stays.past,
|
api.endpoints.v1.Booking.Stays.past,
|
||||||
{
|
{
|
||||||
@@ -131,10 +137,7 @@ export async function getPreviousStays(
|
|||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
params
|
||||||
limit,
|
|
||||||
cursor,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!apiResponse.ok) {
|
if (!apiResponse.ok) {
|
||||||
@@ -168,6 +171,12 @@ export async function getUpcomingStays(
|
|||||||
|
|
||||||
metricsGetUpcomingStays.start()
|
metricsGetUpcomingStays.start()
|
||||||
|
|
||||||
|
const params: Record<string, string> = { limit: String(limit) }
|
||||||
|
|
||||||
|
if (cursor) {
|
||||||
|
params.offset = cursor
|
||||||
|
}
|
||||||
|
|
||||||
const apiResponse = await api.get(
|
const apiResponse = await api.get(
|
||||||
api.endpoints.v1.Booking.Stays.future,
|
api.endpoints.v1.Booking.Stays.future,
|
||||||
{
|
{
|
||||||
@@ -175,10 +184,7 @@ export async function getUpcomingStays(
|
|||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
params
|
||||||
limit,
|
|
||||||
cursor,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!apiResponse.ok) {
|
if (!apiResponse.ok) {
|
||||||
|
|||||||
Reference in New Issue
Block a user