Fixed location entry creation failure still results in success message

This commit is contained in:
2025-11-01 16:28:44 +01:00
parent f588c89df9
commit 0035144730
2 changed files with 10 additions and 2 deletions

View File

@@ -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);