DmitrMakeev commited on
Commit
7a7b2a6
·
verified ·
1 Parent(s): a3d5f80

Update settings.html

Browse files
Files changed (1) hide show
  1. settings.html +26 -3
settings.html CHANGED
@@ -3,6 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <title>Settings</title>
 
6
  <style>
7
  body {
8
  font-family: Arial, sans-serif;
@@ -92,6 +93,7 @@
92
  <button type="button" class="refresh" onclick="refreshSettings()">Обновить данные</button>
93
  </form>
94
 
 
95
  <script>
96
  function loadSettings() {
97
  // Загружаем ключ из локального хранилища
@@ -99,7 +101,6 @@
99
  if (apiKeySys) {
100
  document.getElementById('api_key_sys').value = apiKeySys;
101
  }
102
-
103
  fetch('/load_settings', {
104
  method: 'POST',
105
  headers: {
@@ -131,7 +132,6 @@
131
  data[key] = value;
132
  }
133
  });
134
-
135
  fetch('/save_settings', {
136
  method: 'POST',
137
  headers: {
@@ -142,12 +142,35 @@
142
  .then(response => response.json())
143
  .then(data => {
144
  console.log('Success:', data);
 
 
 
 
 
 
 
145
  })
146
- .catch(error => console.error('Error:', error));
 
 
 
 
 
 
 
 
 
147
  }
148
 
149
  function refreshSettings() {
150
  loadSettings();
 
 
 
 
 
 
 
151
  }
152
 
153
  function saveApiKeySys() {
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <title>Settings</title>
6
+ <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
7
  <style>
8
  body {
9
  font-family: Arial, sans-serif;
 
93
  <button type="button" class="refresh" onclick="refreshSettings()">Обновить данные</button>
94
  </form>
95
 
96
+ <script src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
97
  <script>
98
  function loadSettings() {
99
  // Загружаем ключ из локального хранилища
 
101
  if (apiKeySys) {
102
  document.getElementById('api_key_sys').value = apiKeySys;
103
  }
 
104
  fetch('/load_settings', {
105
  method: 'POST',
106
  headers: {
 
132
  data[key] = value;
133
  }
134
  });
 
135
  fetch('/save_settings', {
136
  method: 'POST',
137
  headers: {
 
142
  .then(response => response.json())
143
  .then(data => {
144
  console.log('Success:', data);
145
+ Toastify({
146
+ text: "Данные сохранены",
147
+ duration: 3000,
148
+ gravity: "top",
149
+ position: "right",
150
+ backgroundColor: "#4CAF50",
151
+ }).showToast();
152
  })
153
+ .catch(error => {
154
+ console.error('Error:', error);
155
+ Toastify({
156
+ text: "Ошибка при сохранении данных",
157
+ duration: 3000,
158
+ gravity: "top",
159
+ position: "right",
160
+ backgroundColor: "#FF0000",
161
+ }).showToast();
162
+ });
163
  }
164
 
165
  function refreshSettings() {
166
  loadSettings();
167
+ Toastify({
168
+ text: "Данные обновлены",
169
+ duration: 3000,
170
+ gravity: "top",
171
+ position: "right",
172
+ backgroundColor: "#FFA500",
173
+ }).showToast();
174
  }
175
 
176
  function saveApiKeySys() {