mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Fix this thingy
This commit is contained in:
parent
a6592beed0
commit
2c114e3f59
1 changed files with 14 additions and 7 deletions
|
@ -5,17 +5,24 @@ import Request from '../Request.jsx'
|
||||||
function Admin() {
|
function Admin() {
|
||||||
const [imp, setimp] = useState();
|
const [imp, setimp] = useState();
|
||||||
const [exp, setexp] = useState();
|
const [exp, setexp] = useState();
|
||||||
const ids = [setimp, setexp];
|
|
||||||
|
|
||||||
const handleSubmit = async (id, event) => {
|
const handleSubmit = async (event) => {
|
||||||
await Request(
|
await Request(
|
||||||
"/api/webui/admin",
|
"/api/webui/admin",
|
||||||
{
|
{
|
||||||
import: !!imp,
|
import: !imp
|
||||||
export: !!exp
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
ids[id](event.target.checked);
|
setimp(!imp);
|
||||||
|
};
|
||||||
|
const handleSubmit2 = async (event) => {
|
||||||
|
await Request(
|
||||||
|
"/api/webui/admin",
|
||||||
|
{
|
||||||
|
export: !exp
|
||||||
|
}
|
||||||
|
);
|
||||||
|
setexp(!exp);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (imp === undefined) {
|
if (imp === undefined) {
|
||||||
|
@ -34,9 +41,9 @@ function Admin() {
|
||||||
<div id="home">
|
<div id="home">
|
||||||
<h1>Admin</h1>
|
<h1>Admin</h1>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="import" name="import" checked={!!imp} onClick={(i)=>handleSubmit(0, i)} />
|
<input type="checkbox" id="import" name="import" checked={!!imp} onClick={(i)=>handleSubmit(i)} />
|
||||||
<label for="import">Allow account imports</label><br/><br/>
|
<label for="import">Allow account imports</label><br/><br/>
|
||||||
<input type="checkbox" id="exp" name="exp" checked={!!exp} onClick={(i)=>handleSubmit(1, i)} />
|
<input type="checkbox" id="exp" name="exp" checked={!!exp} onClick={(i)=>handleSubmit2(i)} />
|
||||||
<label for="exp">Allow account exports</label>
|
<label for="exp">Allow account exports</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue