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() {
|
||||
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() {
|
|||
<div id="home">
|
||||
<h1>Admin</h1>
|
||||
<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/>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue