diff --git a/src/Resources/Views.Home.Locations.de.resx b/src/Resources/Views.Home.Locations.de.resx
index 5be27e5..6d25a0b 100644
--- a/src/Resources/Views.Home.Locations.de.resx
+++ b/src/Resources/Views.Home.Locations.de.resx
@@ -82,4 +82,7 @@
Löschen bestätigen
+
+ Eintrag mit diesem Namen existiert bereits
+
diff --git a/src/Views/Home/Locations.cshtml b/src/Views/Home/Locations.cshtml
index bb14412..7805f4e 100644
--- a/src/Views/Home/Locations.cshtml
+++ b/src/Views/Home/Locations.cshtml
@@ -327,7 +327,7 @@
const result = await response.json();
- if (result) {
+ if (result.success) {
const newLoc = data.Description;
const slugifiedLocationID = `${newLoc.Location}-${newLoc.RoomNumber}-${newLoc.Seat}`
.toLowerCase()
@@ -371,7 +371,12 @@
createForm.reset();
showToast('@T["Location created successfully"]', 'success');
} else {
- showToast(`${result.reason || '@T["Location creation failed"]'}`, 'danger');
+ switch (result.errorMessage) {
+ case "Entry Already Exists":
+ result.errorMessage = "@T["Entry already exists"]";
+ break;
+ }
+ showToast(`${result.errorMessage || '@T["Location creation failed"]'}`, 'danger');
}
} catch (error) {
console.error(error);