diff --git a/script.js b/script.js index a2a0573..cb459df 100644 --- a/script.js +++ b/script.js @@ -4,6 +4,9 @@ function api(url, opts) { return r.json(); }); } +function noServer(err) { + return /Failed to fetch|Unexpected token|Пока никто не подтвердил участие.'; document.getElementById("confirmedCount").hidden = false; document.getElementById("confirmedCount").querySelector("b").textContent = j.total; - return api("/api/wish"); + return api("api/wish"); }) .then(function (j) { renderAdminWishes(j.data); }) .catch(function (err) { @@ -148,7 +151,7 @@ document.getElementById("a-wadd").addEventListener("click", function () { var title = document.getElementById("a-wtitle").value.trim(); var emoji = document.getElementById("a-wemoji").value.trim() || "🎁"; if (!title) return; - api("/api/admin/wish", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pin: pin, title: title, emoji: emoji }) }) + api("api/admin/wish", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pin: pin, title: title, emoji: emoji }) }) .then(function (j) { renderAdminWishes(j.data); renderWishes(j.data); document.getElementById("a-wtitle").value = "";