From 2c114e3f59275ad676a59d9c20d4fbb74ee5563b Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Mon, 27 May 2024 16:35:27 -0500 Subject: [PATCH] Fix this thingy --- webui/src/admin/Admin.jsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/webui/src/admin/Admin.jsx b/webui/src/admin/Admin.jsx index 200f09f..d61a793 100644 --- a/webui/src/admin/Admin.jsx +++ b/webui/src/admin/Admin.jsx @@ -5,17 +5,24 @@ import Request from '../Request.jsx' function Admin() { const [imp, setimp] = useState(); const [exp, setexp] = useState(); - const ids = [setimp, setexp]; - const handleSubmit = async (id, event) => { + const handleSubmit = async (event) => { await Request( "/api/webui/admin", { - import: !!imp, - export: !!exp + import: !imp } ); - ids[id](event.target.checked); + setimp(!imp); + }; + const handleSubmit2 = async (event) => { + await Request( + "/api/webui/admin", + { + export: !exp + } + ); + setexp(!exp); }; if (imp === undefined) { @@ -34,9 +41,9 @@ function Admin() {

Admin

- handleSubmit(0, i)} /> + handleSubmit(i)} />

- handleSubmit(1, i)} /> + handleSubmit2(i)} />