import {useStore} from "../store/store.ts"; import {useNavigate} from "react-router-dom"; import {SubmitHandler, useForm} from "react-hook-form"; import {Eye, EyeOff} from "lucide-react"; import {useState} from "react"; type Inputs = { username: string password: string } export const LoginScreen = ()=>{ const navigate = useNavigate() const [passwordVisible, setPasswordVisible] = useState(false) const { register, handleSubmit} = useForm() const login: SubmitHandler = ({username,password})=>{ fetch('/admin-auth/', { method: 'POST', headers:{ Authorization: `Basic ${btoa(`${username}:${password}`)}` } }).then(r=>{ if(!r.ok) { useStore.getState().setToastState({ open: true, title: "Login failed", success: false }) } else { navigate('/') } }).catch(e=>{ console.error(e) }) } return

Etherpad

Username
Passwort
{passwordVisible? setPasswordVisible(!passwordVisible)}/> : setPasswordVisible(!passwordVisible)}/>}
}