diff --git a/components/wizard/context/wizardStore.tsx b/components/wizard/context/wizardStore.tsx index e32d84f..9f9db25 100644 --- a/components/wizard/context/wizardStore.tsx +++ b/components/wizard/context/wizardStore.tsx @@ -160,6 +160,18 @@ async function createBooking(formData: WizardFormData) { referrerPolicy: 'no-referrer', body: JSON.stringify(formData), }) + + if (response.status === 400) { + const error = await response.json() + throw Error(error.message) + } + + if (!response.ok) { + throw Error( + 'Sorry, konnte nicht gespeichert werden. Bitte versuch es später nochmal!' + ) + } + return response.json() }