|
|
@@ -25,6 +25,7 @@
|
|
|
let endpoint: "create" | "modify" = "create";
|
|
|
let appointmentId: string = "";
|
|
|
let oldAppointmentTimes: AppointmentDateTimes[] = [];
|
|
|
+ let errorMessage: string = "";
|
|
|
|
|
|
|
|
|
let appointmentList: AppointmentList[] = [
|
|
|
@@ -129,6 +130,7 @@
|
|
|
|
|
|
async function saveAppointment() {
|
|
|
if (!topic || !description || !dueDate || !location || !duration || !creatorInputs || !appointmentList) {
|
|
|
+ errorMessage = "not all parameters provided";
|
|
|
return;
|
|
|
}
|
|
|
console.log(appointmentList);
|
|
|
@@ -157,6 +159,14 @@
|
|
|
|
|
|
appointmentSaved = response.status === 200;
|
|
|
|
|
|
+ if (response.status === 400) {
|
|
|
+ errorMessage = "not all parameters provided";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (response.status === 500) {
|
|
|
+ errorMessage = "internal server error";
|
|
|
+ }
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
appointmentSaved = false;
|
|
|
}, 5000);
|
|
|
@@ -208,6 +218,9 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ // add error messages: missing inputs/backend error/...
|
|
|
+ // remove debug logs
|
|
|
+
|
|
|
// get time slots before sending
|
|
|
</script>
|
|
|
|
|
|
@@ -234,6 +247,10 @@
|
|
|
<div class="snackbar green active">Erfolgreich gespeichert</div>
|
|
|
{/if}
|
|
|
|
|
|
+{#if errorMessage}
|
|
|
+ <div class="snackbar error active">{errorMessage}</div>
|
|
|
+{/if}
|
|
|
+
|
|
|
<style>
|
|
|
fieldset {
|
|
|
max-width: 90%;
|