mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed location entry creation failure still results in success message
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user