mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 10:35:30 +00:00
BUGFIX: values resetted if error
This commit is contained in:
@@ -248,6 +248,7 @@ export class AlmanachEditPage extends HTMLElement {
|
||||
try {
|
||||
const response = await fetch(this._saveEndpoint, {
|
||||
method: "POST",
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
@@ -296,6 +297,7 @@ export class AlmanachEditPage extends HTMLElement {
|
||||
try {
|
||||
const response = await fetch(this._saveEndpoint, {
|
||||
method: "POST",
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
@@ -684,6 +686,7 @@ export class AlmanachEditPage extends HTMLElement {
|
||||
}
|
||||
this._statusEl.textContent = "";
|
||||
this._statusEl.classList.remove("text-red-700", "text-green-700", "save-feedback-error", "save-feedback-success");
|
||||
this._statusEl.classList.remove("is-hidden");
|
||||
this._statusEl.classList.add("hidden");
|
||||
}
|
||||
|
||||
@@ -694,11 +697,29 @@ export class AlmanachEditPage extends HTMLElement {
|
||||
this._clearStatus();
|
||||
this._statusEl.textContent = message;
|
||||
this._statusEl.classList.remove("hidden");
|
||||
this._statusEl.classList.remove("is-hidden");
|
||||
if (type === "success") {
|
||||
this._statusEl.classList.add("text-green-700", "save-feedback-success");
|
||||
} else if (type === "error") {
|
||||
this._statusEl.classList.add("text-red-700", "save-feedback-error");
|
||||
}
|
||||
if (type === "success") {
|
||||
const el = this._statusEl;
|
||||
if (el) {
|
||||
if (el.dataset.autohideScheduled === "true") {
|
||||
return;
|
||||
}
|
||||
el.dataset.autohideScheduled = "true";
|
||||
setTimeout(() => {
|
||||
el.classList.add("is-hiding");
|
||||
setTimeout(() => {
|
||||
el.classList.add("is-hidden");
|
||||
el.classList.remove("is-hiding");
|
||||
delete el.dataset.autohideScheduled;
|
||||
}, 320);
|
||||
}, 4000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async _reloadForm(successMessage) {
|
||||
@@ -711,6 +732,7 @@ export class AlmanachEditPage extends HTMLElement {
|
||||
}
|
||||
|
||||
const response = await fetch(targetUrl.toString(), {
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
"X-Requested-With": "fetch",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user