diff --git a/src/apps/reservation-list/list/reservation-list.test.ts b/src/apps/reservation-list/list/reservation-list.test.ts index b645d25826..2622b1c78c 100644 --- a/src/apps/reservation-list/list/reservation-list.test.ts +++ b/src/apps/reservation-list/list/reservation-list.test.ts @@ -219,7 +219,22 @@ describe("Reservation list", () => { pickupNumber: null, ilBibliographicRecord: null, transactionId: "cae4db22-e267-4087-bdaa-d880bef19b52", - reservationType: "normal" + reservationType: "parallel" + }, + { + reservationId: 67843847, + recordId: "62485125", + state: "reserved", + pickupBranch: "DK-775100", + pickupDeadline: null, + expiryDate: "2022-12-12", + dateOfReservation: "2022-06-15T11:41:24.075", + numberInQueue: 206, + periodical: null, + pickupNumber: null, + ilBibliographicRecord: null, + transactionId: "cae4db22-e267-4087-bdaa-d880bef19b52", + reservationType: "parallel" } ] } diff --git a/src/apps/reservation-list/list/reservation-list.tsx b/src/apps/reservation-list/list/reservation-list.tsx index 88b6bfef7f..b1862e2382 100644 --- a/src/apps/reservation-list/list/reservation-list.tsx +++ b/src/apps/reservation-list/list/reservation-list.tsx @@ -14,11 +14,10 @@ import { } from "../../../core/utils/helpers/general"; import { useGetV1UserReservations } from "../../../core/publizon/publizon"; import { - mapFBSReservationToReservationType, + mapFBSReservationGroupToReservationType, mapPublizonReservationToReservationType } from "../../../core/utils/helpers/list-mapper"; import ReservationPauseToggler from "./reservation-pause-toggler"; -import { useGetReservationsV2 } from "../../../core/fbs/fbs"; import { PatronV5, ReservationDetailsV2 } from "../../../core/fbs/model"; import EmptyReservations from "./EmptyReservations"; import PauseReservation from "../modal/pause-reservation/pause-reservation"; @@ -34,6 +33,7 @@ import { getUrlQueryParam } from "../../../core/utils/helpers/url"; import { getDetailsModalId } from "../../../core/utils/helpers/modal-helpers"; import { getFromListByKey } from "../../loan-list/utils/helpers"; import { usePatronData } from "../../../components/material/helper"; +import useGetReservationGroups from "../../../core/utils/useGetReservationGroups"; export interface ReservationListProps { pageSize: number; @@ -56,7 +56,7 @@ const ReservationList: FC = ({ pageSize }) => { isSuccess: isSuccessFBS, data, isLoading: isLoadingFBS - } = useGetReservationsV2(); + } = useGetReservationGroups(); const { isSuccess: isSuccessPublizon, @@ -119,12 +119,13 @@ const ReservationList: FC = ({ pageSize }) => { // "reserved"-reservations have their own list useEffect(() => { if (isSuccessFBS && data) { - const fbsToReservationType = mapFBSReservationToReservationType(data); + const fbsToReservationType = + mapFBSReservationGroupToReservationType(data); const readyForPickup = getReadyForPickup(fbsToReservationType); const sortedByOldest = sortByOldestPickupDeadline(readyForPickup); setReadyForPickupReservationsFBS(sortedByOldest); setReservedReservationsFBS( - getReservedPhysical(mapFBSReservationToReservationType(data)) + getReservedPhysical(mapFBSReservationGroupToReservationType(data)) ); } else if (!isSuccessFBS) { setReservedReservationsFBS([]);