File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -71,15 +71,21 @@ export class BookingService {
7171 }
7272
7373 cancelBooking ( bookingId : string ) {
74- return this . bookings . pipe (
75- take ( 1 ) ,
76- delay ( 1000 ) ,
77- tap ( ( bookings ) => {
78- this . _bookings . next (
79- bookings . filter ( ( booking ) => booking . id !== bookingId )
80- ) ;
81- } )
82- ) ;
74+ return this . http
75+ . delete (
76+ `https://ionic-angular-backend-66c35-default-rtdb.asia-southeast1.firebasedatabase.app/bookings/${ bookingId } .json`
77+ )
78+ . pipe (
79+ switchMap ( ( ) => {
80+ return this . bookings ;
81+ } ) ,
82+ take ( 1 ) ,
83+ tap ( ( bookings ) => {
84+ this . _bookings . next (
85+ bookings . filter ( ( booking ) => booking . id !== bookingId )
86+ ) ;
87+ } )
88+ ) ;
8389 }
8490
8591 fetchBookings ( ) {
Original file line number Diff line number Diff line change 2323 < ion-list >
2424 < ion-item-sliding *ngFor ="let booking of loadedBookings " #slidingBooking >
2525 < ion-item >
26+ < ion-avatar slot ="start ">
27+ < ion-img [src] ="booking.placeImage "> </ ion-img >
28+ </ ion-avatar >
2629 < ion-label >
2730 < h5 > {{booking.placeTitle}}</ h5 >
2831 < p > Guest: {{booking.guestnumber}}</ p >
2932 </ ion-label >
3033 </ ion-item >
31- < ion-item-options side ="start ">
34+ < ion-item-options side ="end ">
3235 < ion-item-option color ="danger " (click) ="onCancelBooking(booking.id, slidingBooking) ">
3336 < ion-icon name ="trash " slot ="icon-only "> </ ion-icon >
3437 </ ion-item-option >
You can’t perform that action at this time.
0 commit comments