FrontEnd Bug Fix
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user