Move runtime data into config directory

This commit is contained in:
troogs
2026-10-01 18:20:05 +02:00
parent 944eed3eb3
commit 2e182d63a3
13 changed files with 509 additions and 79 deletions
+2 -2
View File
@@ -19,13 +19,13 @@
const selectedDate = localStorage.getItem("selectedDate");
const selectedName = localStorage.getItem("selectedName");
if (!selectedActivity || !selectedDate || !selectedName) {
if (!selectedActivity || !selectedDate) {
window.location.href = "index.html";
return;
}
summaryActivity.textContent = selectedActivity;
summaryName.textContent = selectedName;
summaryName.textContent = selectedName || "Nicht angegeben";
const dateObj = new Date(`${selectedDate}T00:00:00`);
const formattedDate = dateObj.toLocaleDateString("de-DE", {
+10 -4
View File
@@ -30,15 +30,21 @@
fetch("/api/settings", { cache: "no-store" })
.then((response) => response.json())
.then((settings) => renderNames(settings.names || []))
.then((settings) => {
const names = settings.names || [];
if (names.length === 0) {
localStorage.setItem("selectedName", "");
window.location.href = "checkout.html";
return;
}
renderNames(names);
})
.catch(() => {
nameList.textContent = "Namen konnten nicht geladen werden.";
});
function renderNames(names) {
const options = names.length > 0 ? names : ["Du weißt, wer ich bin"];
options.forEach((name) => {
names.forEach((name) => {
const card = document.createElement("button");
card.type = "button";
card.className = "name-card";