Merge pull request #309 from Malte-D/hotfix/booking-no-await
booking hotfix
This commit is contained in:
		
						commit
						dada6a3a79
					
				
					 1 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
					@ -101,7 +101,8 @@ export default function Book(props) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            telemetry.withJitsu(jitsu => jitsu.track(telemetryEventTypes.bookingConfirmed, collectPageParameters()));
 | 
					            telemetry.withJitsu(jitsu => jitsu.track(telemetryEventTypes.bookingConfirmed, collectPageParameters()));
 | 
				
			||||||
            const res = await fetch(
 | 
					
 | 
				
			||||||
 | 
					            /*const res = await */fetch(
 | 
				
			||||||
              '/api/book/' + user,
 | 
					              '/api/book/' + user,
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                  body: JSON.stringify(payload),
 | 
					                  body: JSON.stringify(payload),
 | 
				
			||||||
| 
						 | 
					@ -111,8 +112,8 @@ export default function Book(props) {
 | 
				
			||||||
                  method: 'POST'
 | 
					                  method: 'POST'
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 | 
					            // TODO When the endpoint is fixed, change this to await the result again
 | 
				
			||||||
            if (res.ok) {
 | 
					            //if (res.ok) {
 | 
				
			||||||
                let successUrl = `/success?date=${date}&type=${props.eventType.id}&user=${props.user.username}&reschedule=${!!rescheduleUid}&name=${payload.name}`;
 | 
					                let successUrl = `/success?date=${date}&type=${props.eventType.id}&user=${props.user.username}&reschedule=${!!rescheduleUid}&name=${payload.name}`;
 | 
				
			||||||
                if (payload['location']) {
 | 
					                if (payload['location']) {
 | 
				
			||||||
                    if (payload['location'].includes('integration')) {
 | 
					                    if (payload['location'].includes('integration')) {
 | 
				
			||||||
| 
						 | 
					@ -124,10 +125,10 @@ export default function Book(props) {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                await router.push(successUrl);
 | 
					                await router.push(successUrl);
 | 
				
			||||||
            } else {
 | 
					            /*} else {
 | 
				
			||||||
                setLoading(false);
 | 
					                setLoading(false);
 | 
				
			||||||
                setError(true);
 | 
					                setError(true);
 | 
				
			||||||
            }
 | 
					            }*/
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        event.preventDefault();
 | 
					        event.preventDefault();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue