diff --git a/data/index.html b/data/index.html
index bb008ba..1623ed9 100644
--- a/data/index.html
+++ b/data/index.html
@@ -6,6 +6,7 @@
Konfiguration
+
diff --git a/data/load-data.js b/data/load-data.js
new file mode 100644
index 0000000..2ae6f1e
--- /dev/null
+++ b/data/load-data.js
@@ -0,0 +1,35 @@
+const form = document.querySelector("form");
+
+async function loadData() {
+ try {
+ const req = await fetch("/config", {
+ method: "GET",
+ });
+ if (!req.ok) {
+ throw new Error(`Response status: ${req.status}`);
+ }
+
+ const json = await req.json();
+ console.log(json);
+ return json;
+ } catch (error) {
+ console.log(error);
+ return null;
+ }
+}
+
+function writeDataToInput(data) {
+ console.log("write data", typeof data);
+ for (const [key, value] of Object.entries(data)) {
+ const element = document.querySelector(`[name=${key}]`);
+ console.log(element);
+ element.value = value;
+ }
+ // send "change" event
+ form.dispatchEvent(new Event("change", { bubbles: true }));
+}
+
+const data = await loadData();
+if (data !== null) {
+ writeDataToInput(data);
+}