| Davit Tabidze | f99bc4f | 2024-01-17 22:37:32 +0400 | [diff] [blame] | 1 | function toggle(name, status) { |
| 2 | const data = { | ||||
| 3 | name: name, | ||||
| 4 | active: status, | ||||
| 5 | }; | ||||
| 6 | fetch("/api/update/", { | ||||
| 7 | method: "POST", | ||||
| 8 | headers: { | ||||
| 9 | "Content-Type": "application/json", | ||||
| 10 | }, | ||||
| 11 | body: JSON.stringify(data), | ||||
| 12 | }) | ||||
| 13 | .then((response) => { | ||||
| 14 | if (response.ok) { | ||||
| 15 | window.location.reload(); | ||||
| 16 | } | ||||
| 17 | }) | ||||
| 18 | .catch((error) => { | ||||
| 19 | console.error("Error:", error); | ||||
| 20 | }); | ||||
| 21 | } | ||||