S
Size: a a a
S
S
L
OS
S
OS
L
NL
L
L
VB
IF
AK
LS
LS
AK
LS
С
S
DT
export const GetBookedTimeSlotsForBike = createAction(
'[Booking] Get booked time slots'
);
export const SetBookedTimeSlotsForBike = createAction(
'[Booking] Get booked time slots',
props<{bookedSlots: TimeSlotModel[]}>()
);
getBookedTimeSlotsForBike$ = createEffect(() =>
this.actions$.pipe(
ofType(BookingActions.GetBookedTimeSlotsForBike),
withLatestFrom(this.store.select(selectBookingBikeId)),
switchMap(([action, bikeId]) => this.riderService.getReservedTimeSlotsForBike(bikeId)
.pipe(
map((slots: TimeSlotModel[]) => BookingActions.SetBookedTimeSlotsForBike({bookedSlots: slots})),
catchError(err => this.handleError(err))
)
)
)
);
on(BookingActions.SetBookedTimeSlotsForBike,
(state, {bookedSlots}) => ({...state, bookedSlots})
)