Admin webui with one single option
This commit is contained in:
@ -29,6 +29,11 @@ function Login() {
|
||||
e.preventDefault();
|
||||
window.location.href = "/import/";
|
||||
}
|
||||
|
||||
const adminPanel = (e) => {
|
||||
e.preventDefault();
|
||||
window.location.href = "/admin/";
|
||||
}
|
||||
|
||||
return (
|
||||
<div id="login-form">
|
||||
@ -40,7 +45,8 @@ function Login() {
|
||||
<input type="password" id="password" name="password" onChange={(event) => {password = event.target.value}} />
|
||||
<input type="submit" value="Submit" onClick={handleSubmit}/>
|
||||
<div id="sub_div">
|
||||
<button onClick={import_user}>Import User</button>
|
||||
<button onClick={import_user}>Import User</button><br/><br/>
|
||||
<button hidden={!["127.0.0.1", "localhost"].includes(window.location.hostname)} onClick={adminPanel}>Admin panel</button>
|
||||
{ error[0] ? <p>Error: { error[0] } </p> : <p></p> }
|
||||
</div>
|
||||
</form>
|
||||
|
@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client'
|
||||
import Login from './login/Login.jsx'
|
||||
import Home from './home/Home.jsx'
|
||||
import Import from './import/Import.jsx'
|
||||
import Admin from './admin/Admin.jsx'
|
||||
|
||||
let Elem;
|
||||
switch (window.location.pathname) {
|
||||
@ -15,12 +16,17 @@ switch (window.location.pathname) {
|
||||
case "/import/":
|
||||
Elem = Import;
|
||||
break;
|
||||
case "/admin/":
|
||||
Elem = Admin;
|
||||
break;
|
||||
default:
|
||||
window.location.pathname = "/";
|
||||
}
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<Elem />
|
||||
</React.StrictMode>,
|
||||
)
|
||||
if (Elem) {
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<Elem />
|
||||
</React.StrictMode>,
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user