File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,18 @@ class DetailViewModel: ObservableObject {
6969                        self . appAlert =  . basic( title:  " Success! " , 
7070                                               message:  bookingResult. message ??  " Trip booked successfully " ) 
7171
72-                         Network . shared. apollo. store. withinReadWriteTransaction  {  transaction in 
73-                             let  cacheMutation  =  MeTripsLocalCacheMutation ( ) 
72+                         if  let  bookedTrip =  bookingResult. launches? . first ??  nil  { 
73+                             Network . shared. apollo. store. withinReadWriteTransaction  {  transaction in 
74+                                 let  cacheMutation  =  MeTripsLocalCacheMutation ( ) 
7475
75-                             try . update ( cacheMutation)  {  data in 
76-                                 data. me? . trips. append ( . init( 
77-                                     isBooked:  true , 
78-                                     id:  id
79-                                 ) ) 
76+                                 try . update ( cacheMutation)  {  data in 
77+                                     data. me? . trips. append ( . init( 
78+                                         isBooked:  bookedTrip. isBooked, 
79+                                         id:  bookedTrip. id, 
80+                                         site:  bookedTrip. site, 
81+                                         mission:  bookedTrip. mission
82+                                     ) ) 
83+                                 } 
8084                            } 
8185                        } 
8286                    }  else  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments