Move runtime data into config directory
This commit is contained in:
+10
-4
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user