mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Merge pull request #219 from LD-Reborn/217-bug-create-location-failure-still-results-in-success-message
aFixed location entry creation failure still results in success message
This commit is contained in:
@@ -82,4 +82,7 @@
|
|||||||
<data name="Confirm Delete" xml:space="preserve">
|
<data name="Confirm Delete" xml:space="preserve">
|
||||||
<value>Löschen bestätigen</value>
|
<value>Löschen bestätigen</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Entry already exists" xml:space="preserve">
|
||||||
|
<value>Eintrag mit diesem Namen existiert bereits</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
@@ -327,7 +327,7 @@
|
|||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result) {
|
if (result.success) {
|
||||||
const newLoc = data.Description;
|
const newLoc = data.Description;
|
||||||
const slugifiedLocationID = `${newLoc.Location}-${newLoc.RoomNumber}-${newLoc.Seat}`
|
const slugifiedLocationID = `${newLoc.Location}-${newLoc.RoomNumber}-${newLoc.Seat}`
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@@ -371,7 +371,12 @@
|
|||||||
createForm.reset();
|
createForm.reset();
|
||||||
showToast('@T["Location created successfully"]', 'success');
|
showToast('@T["Location created successfully"]', 'success');
|
||||||
} else {
|
} 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) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user