Update settings.html
Browse files- settings.html +8 -2
settings.html
CHANGED
@@ -81,7 +81,11 @@
|
|
81 |
<script>
|
82 |
function loadSettings() {
|
83 |
fetch('/settings', {
|
84 |
-
method: '
|
|
|
|
|
|
|
|
|
85 |
})
|
86 |
.then(response => response.json())
|
87 |
.then(data => {
|
@@ -96,6 +100,7 @@
|
|
96 |
})
|
97 |
.catch(error => console.error('Error:', error));
|
98 |
}
|
|
|
99 |
function saveSettings() {
|
100 |
const form = document.getElementById('settingsForm');
|
101 |
const formData = new FormData(form);
|
@@ -110,7 +115,7 @@
|
|
110 |
headers: {
|
111 |
'Content-Type': 'application/json'
|
112 |
},
|
113 |
-
body: JSON.stringify(data)
|
114 |
})
|
115 |
.then(response => response.json())
|
116 |
.then(data => {
|
@@ -118,6 +123,7 @@
|
|
118 |
})
|
119 |
.catch(error => console.error('Error:', error));
|
120 |
}
|
|
|
121 |
window.onload = loadSettings;
|
122 |
</script>
|
123 |
</body>
|
|
|
81 |
<script>
|
82 |
function loadSettings() {
|
83 |
fetch('/settings', {
|
84 |
+
method: 'POST',
|
85 |
+
headers: {
|
86 |
+
'Content-Type': 'application/json'
|
87 |
+
},
|
88 |
+
body: JSON.stringify({ action: 'load' })
|
89 |
})
|
90 |
.then(response => response.json())
|
91 |
.then(data => {
|
|
|
100 |
})
|
101 |
.catch(error => console.error('Error:', error));
|
102 |
}
|
103 |
+
|
104 |
function saveSettings() {
|
105 |
const form = document.getElementById('settingsForm');
|
106 |
const formData = new FormData(form);
|
|
|
115 |
headers: {
|
116 |
'Content-Type': 'application/json'
|
117 |
},
|
118 |
+
body: JSON.stringify({ action: 'save', data: data })
|
119 |
})
|
120 |
.then(response => response.json())
|
121 |
.then(data => {
|
|
|
123 |
})
|
124 |
.catch(error => console.error('Error:', error));
|
125 |
}
|
126 |
+
|
127 |
window.onload = loadSettings;
|
128 |
</script>
|
129 |
</body>
|