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
+19 -3
View File
@@ -5,6 +5,7 @@ import InputForm from "@/components/InputForm";
import {useRouter} from "next/router";
import PopUp from "@/components/PopUp";
import Background from "@/components/Background";
import Logout from "@/components/Logout";
export default function SemesterOverview(p)
{
@@ -12,9 +13,14 @@ export default function SemesterOverview(p)
{
let urlTest = "http://localhost:8080/semester/all?sessionid=" + localStorage.getItem("sessionid");
await fetch(urlTest).then(response => response.json()).then(s => {
setEntries(s)
})
try {
await fetch(urlTest).then(response => response.json()).then(s => {
setEntries(s)
})
} catch(e)
{
router.push("/")
}
}
function onClickSemester(e, m)
@@ -83,8 +89,17 @@ export default function SemesterOverview(p)
useEffect(() => {
getSemesters();
let checkURL = "http://localhost:8080/users/check?sessionid=" + localStorage.getItem("sessionid");
try {
fetch(checkURL).then(r => console.log(r))
}
catch(e)
{
router.push("/")
}
}, [])
const [entries, setEntries] = useState([])
const [modalDisplay, setModalDisplay] = useState("none");
const [modalHint, setModalHint] = useState("");
@@ -92,6 +107,7 @@ export default function SemesterOverview(p)
return (
<div className={"semester-overview"}>
<Logout/>
<Background/>
{
entries.map(e => (<SemesterTile text={e.name} onClick={(f) => onClickSemester(e, f)} onButtonDeleteClick={() => {