FrontEnd Bug Fix

This commit is contained in:
brausjonas
2023-05-24 16:05:21 +02:00
parent 337aea6a65
commit f42f2df078
7 changed files with 1314 additions and 5 deletions
+8 -2
View File
@@ -43,7 +43,13 @@ export default function InputForm(p) {
let url = "http://localhost:8080/users/all?sessionid=" + sessionid;
await fetch(url).then(response => response.json()).then(user => setUsers(user));
try {
await fetch(url).then(response => response.json()).then(user => setUsers(user));
}
catch(e)
{
router.push("/")
}
}
useEffect(() => {
@@ -213,7 +219,7 @@ export default function InputForm(p) {
}}><input type="checkbox" onChange={(e) => {
onCheckBoxClicked(user, e);
}}/></div></td>
<td style={{}}>{user.firstName + " " + user.lastName}</td>
<td style={{textAlign: "center"}}>{user.firstName + " " + user.lastName}</td>
<select id={"userSelect"} name={"userSelect"} className={"box-shadow selector"}
multiple={false} style={{
maxHeight: 80,
+24
View File
@@ -0,0 +1,24 @@
import Button from "@/components/Button";
import {useRouter} from "next/router";
export default function Logout()
{
const router = useRouter()
async function logout()
{
let url = "http://localhost:8080/users/logout?sessionid=" + localStorage.getItem("sessionid");
await fetch(url)
await router.push("/")
}
return (
<div style={{
position: "absolute",
left: 20,
top: 20
}}>
<Button onClick={() => logout()} text={"Logout"} color={"#77932b"} width={100} height={40}/>
</div>
)
}