Use URL as Constant

This commit is contained in:
brausjonas
2023-05-30 02:28:51 +02:00
parent a0d6d15099
commit dac59d4a23
11 changed files with 343890 additions and 89 deletions
+172 -73
View File
@@ -3,6 +3,7 @@ import Button from "@/components/Button";
import {list} from "postcss"; import {list} from "postcss";
import Background from "@/components/Background"; import Background from "@/components/Background";
import WeekSelector from "@/components/WeekSelector"; import WeekSelector from "@/components/WeekSelector";
import {baseURL} from "@/components/Constants";
let cellHeight = 20; let cellHeight = 20;
@@ -21,15 +22,19 @@ export default function CalenderView(p) {
const scrollRef = useRef(null); const scrollRef = useRef(null);
function readEntries() { function readEntries() {
let url = "http://localhost:8080/entries?semesterid=" + localStorage.getItem("currentsid") + let url = baseURL + "/entries?semesterid=" + localStorage.getItem("currentsid") +
"&daynumber=" + currentWeekStartDay + "&yearnumber=" + currentYear + "&sessionid=" + localStorage.getItem("sessionid"); "&daynumber=" + currentWeekStartDay + "&yearnumber=" + currentYear + "&sessionid=" + localStorage.getItem("sessionid");
fetch(url).then(r => r.json()).then(en => { try {
setEntries(en) fetch(url).then(r => r.json()).then(en => {
}) setEntries(en)
})
}catch (e) {
}
} }
function pushEntry(currentColumnID, row) { function pushEntry(currentColumnID, row) {
let url = "http://localhost:8080/entries" + "?sessionid=" + localStorage.getItem("sessionid") let url = baseURL + "/entries" + "?sessionid=" + localStorage.getItem("sessionid")
let json = { let json = {
"id": 0, "id": 0,
"daynumber": currentWeekStartDay + currentColumnID, "daynumber": currentWeekStartDay + currentColumnID,
@@ -50,7 +55,7 @@ export default function CalenderView(p) {
} }
function deleteEntry(id) { function deleteEntry(id) {
let url = "http://localhost:8080/entries?id=" + id + "&sessionid=" + localStorage.getItem("sessionid"); let url = baseURL + "/entries?id=" + id + "&sessionid=" + localStorage.getItem("sessionid");
fetch(url, { fetch(url, {
method: "DELETE" method: "DELETE"
}).then(r => readEntries()) }).then(r => readEntries())
@@ -89,7 +94,7 @@ export default function CalenderView(p) {
if (selectedElement != null) { if (selectedElement != null) {
let id = selectedElement.id; let id = selectedElement.id;
let url = "http://localhost:8080/entries?sessionid=" + localStorage.getItem("sessionid"); let url = baseURL + "/entries?sessionid=" + localStorage.getItem("sessionid");
let json = { let json = {
"id": id, "id": id,
"daynumber": 0, "daynumber": 0,
@@ -119,12 +124,51 @@ export default function CalenderView(p) {
let row = Math.floor((y_window - y_target_offset) / cellHeight) + 1; let row = Math.floor((y_window - y_target_offset) / cellHeight) + 1;
let currentColumnID = parseInt(e.currentTarget.id) let currentColumnID = parseInt(e.currentTarget.id)
if (grabbedDown) if (grabbedDown) {
if (row - 1 > selectedElement.timestart) {
let free = true;
for(let i = 0; i < entries[currentColumnID].length; i++)
{
if(entries[currentColumnID][i] != null && selectedElement !== entries[currentColumnID][i])
{
if(row <= entries[currentColumnID][i].timeend &&
row >= entries[currentColumnID][i].timestart ||
row > entries[currentColumnID][i].timeend &&
selectedElement.timestart < entries[currentColumnID][i].timestart)
{
free = false;
break;
}
}
}
if(free) {
selectedElement.timeend = row + 1;
}
}
} else if (row + 2 < selectedElement.timeend)
{ {
selectedElement.timeend = row + 1; let free = true;
}else for(let i = 0; i < entries[currentColumnID].length; i++)
{ {
selectedElement.timestart = row; if(entries[currentColumnID][i] != null && selectedElement !== entries[currentColumnID][i])
{
if(row < entries[currentColumnID][i].timeend &&
row >= entries[currentColumnID][i].timestart ||
row < entries[currentColumnID][i].timestart &&
selectedElement.timeend > entries[currentColumnID][i].timestart)
{
free = false;
break;
}
}
}
if(free)
{
selectedElement.timestart = row;
}
} }
setUpdate(!update); setUpdate(!update);
} }
@@ -136,6 +180,7 @@ export default function CalenderView(p) {
let row = Math.floor((y_window - y_target_offset) / cellHeight) + 1; let row = Math.floor((y_window - y_target_offset) / cellHeight) + 1;
let currentColumnID = parseInt(e.currentTarget.id) let currentColumnID = parseInt(e.currentTarget.id)
let currentId = e.target.id; let currentId = e.target.id;
let currentUserID = localStorage.getItem("userid");
if (e.button === 0) { if (e.button === 0) {
if (!currentId.includes("e")) { if (!currentId.includes("e")) {
@@ -144,20 +189,16 @@ export default function CalenderView(p) {
pushEntry(currentColumnID, row) pushEntry(currentColumnID, row)
} }
} else { } else {
grabbedDown = currentId.includes("down")
/*
if(currentId.includes("up"))
{
grabbedDown = false;
}else grabbedDown = true;
*/
let parentID = parseInt(e.target.parentElement.id.replace("e", "")); let parentID = parseInt(e.target.parentElement.id.replace("e", ""));
selectedElement = getElementInColumn(parentID, currentColumnID); if(currentUserID == getElementInColumn(parentID, currentColumnID).usercreatedbyid) {
grabbedDown = currentId.includes("down")
selectedElement = getElementInColumn(parentID, currentColumnID);
}
} }
} }
} else if (e.button === 2) { } else if (e.button === 2) {
if (currentId.includes("e")) { let parentID = parseInt(e.target.id.replace("e", ""));
if (currentUserID == getElementInColumn(parentID, currentColumnID).usercreatedbyid && currentId.includes("e")) {
let id = parseInt(currentId.replace("e", "")) let id = parseInt(currentId.replace("e", ""))
deleteEntry(id) deleteEntry(id)
} }
@@ -174,6 +215,31 @@ export default function CalenderView(p) {
readEntries() readEntries()
} }
function getEntryColor(userCreatedByID)
{
let id = localStorage.getItem("userid");
if(id == userCreatedByID)
{
return "#77932b";
}
else
{
return "#a2a2a2";
}
}
function getResizeBarColor(userCreatedByID)
{
let id = localStorage.getItem("userid");
if(id == userCreatedByID)
{
return "#5a6c20";
}
else{
return "#a2a2a2";
}
}
useEffect(() => { useEffect(() => {
semesterStart = 0; semesterStart = 0;
currentWeekStartDay = 0; currentWeekStartDay = 0;
@@ -181,7 +247,7 @@ export default function CalenderView(p) {
selectedElement = null; selectedElement = null;
grabbedDown = false; grabbedDown = false;
let url = "http://localhost:8080/semester/id?sessionid=" + localStorage.getItem("sessionid") + let url = baseURL + "/semester/id?sessionid=" + localStorage.getItem("sessionid") +
"&id=" + localStorage.getItem("currentsid"); "&id=" + localStorage.getItem("currentsid");
fetch(url).then(r => r.json()).then(s => { fetch(url).then(r => r.json()).then(s => {
@@ -194,27 +260,25 @@ export default function CalenderView(p) {
window.addEventListener("contextmenu", (e) => (e.preventDefault())) window.addEventListener("contextmenu", (e) => (e.preventDefault()))
window.addEventListener("keypress", (e) => { window.addEventListener("keypress", (e) => {
if(e.key === "+") try {
{ if (e.key === "+") {
scrollRef.current.scrollTop = scrollRef.current.scrollTop + 100; cellHeight += 2
cellHeight += 2 } else if (e.key === "-") {
} if (cellHeight - 2 >= 8) {
else if(e.key === "-") cellHeight -= 2
{ }
if(cellHeight - 2 >= 8)
{
scrollRef.current.scrollTop = scrollRef.current.scrollTop - 100;
cellHeight -= 2
} }
} catch (e) {
} }
}) })
setInterval(function(){ setInterval(function () {
if (selectedElement == null){ if (selectedElement == null) {
readEntries() readEntries()
} }
}, 100); }, 500);
}, []) }, [])
@@ -252,18 +316,29 @@ export default function CalenderView(p) {
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
backgroundColor: "white", backgroundColor: "white",
gap: 5 gap: 5,
}}> }}>
<div style={{borderRadius: 10, padding: 10, backgroundColor: "#f1f1f1"}} className={"box-shadow"}>
<div style={{ borderRadius: 10, padding: 10, backgroundColor: "#f1f1f1"}} className={"box-shadow"}>
<div> <div>
<div className={"wochen-tag-container"}> <div className={"wochen-tag-container"}>
<div className={"wochen-tag font-big"}>Montag {new Date(currentYear, 0, currentWeekStartDay).getDate()}.</div> <div
<div className={"wochen-tag font-big"}>Dienstag {new Date(currentYear, 0, currentWeekStartDay + 1).getDate()}.</div> className={"wochen-tag font-big"}>Montag {new Date(currentYear, 0, currentWeekStartDay).getDate()}.
<div className={"wochen-tag font-big"}>Mittwoch {new Date(currentYear, 0, currentWeekStartDay + 2).getDate()}.</div> </div>
<div className={"wochen-tag font-big"}>Donnerstag {new Date(currentYear, 0, currentWeekStartDay + 3).getDate()}.</div> <div
<div className={"wochen-tag font-big"}>Freitag {new Date(currentYear, 0, currentWeekStartDay + 4).getDate()}.</div> className={"wochen-tag font-big"}>Dienstag {new Date(currentYear, 0, currentWeekStartDay + 1).getDate()}.
<div className={"wochen-tag font-big"}>Samstag {new Date(currentYear, 0, currentWeekStartDay + 5).getDate()}.</div> </div>
<div
className={"wochen-tag font-big"}>Mittwoch {new Date(currentYear, 0, currentWeekStartDay + 2).getDate()}.
</div>
<div
className={"wochen-tag font-big"}>Donnerstag {new Date(currentYear, 0, currentWeekStartDay + 3).getDate()}.
</div>
<div
className={"wochen-tag font-big"}>Freitag {new Date(currentYear, 0, currentWeekStartDay + 4).getDate()}.
</div>
<div
className={"wochen-tag font-big"}>Samstag {new Date(currentYear, 0, currentWeekStartDay + 5).getDate()}.
</div>
</div> </div>
</div> </div>
<div className={"calender-container"} ref={scrollRef}> <div className={"calender-container"} ref={scrollRef}>
@@ -281,14 +356,18 @@ export default function CalenderView(p) {
width: "100%", width: "100%",
gridRowStart: d.timestart, gridRowStart: d.timestart,
gridRowEnd: d.timeend, gridRowEnd: d.timeend,
backgroundColor: "#77932b" backgroundColor: getEntryColor(d.usercreatedbyid)
}} id={d.id + "e"}> }} id={d.id + "e"}>
<div className={"resize-grab"} id={"grabup"}></div> <div className={"resize-grab"} id={"grabup"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>Modul</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"}></div> <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
</div>))} </div>))}
</div> </div>
@@ -303,15 +382,19 @@ export default function CalenderView(p) {
width: "100%", width: "100%",
gridRowStart: d.timestart, gridRowStart: d.timestart,
gridRowEnd: d.timeend, gridRowEnd: d.timeend,
backgroundColor: "#77932b" backgroundColor: getEntryColor(d.usercreatedbyid)
}} id={d.id + "e"}> }} id={d.id + "e"}>
<div className={"resize-grab"} id={"grabup"}></div> <div className={"resize-grab"} id={"grabup"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>Modul</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"}></div> <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
</div>))} </div>))}
</div> </div>
@@ -327,15 +410,19 @@ export default function CalenderView(p) {
width: "100%", width: "100%",
gridRowStart: d.timestart, gridRowStart: d.timestart,
gridRowEnd: d.timeend, gridRowEnd: d.timeend,
backgroundColor: "#77932b" backgroundColor: getEntryColor(d.usercreatedbyid)
}} id={d.id + "e"}> }} id={d.id + "e"}>
<div className={"resize-grab"} id={"grabup"}></div> <div className={"resize-grab"} id={"grabup"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>Modul</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"}></div> <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
</div>))} </div>))}
</div> </div>
@@ -350,15 +437,19 @@ export default function CalenderView(p) {
width: "100%", width: "100%",
gridRowStart: d.timestart, gridRowStart: d.timestart,
gridRowEnd: d.timeend, gridRowEnd: d.timeend,
backgroundColor: "#77932b" backgroundColor: getEntryColor(d.usercreatedbyid)
}} id={d.id + "e"}> }} id={d.id + "e"}>
<div className={"resize-grab"} id={"grabup"}></div> <div className={"resize-grab"} id={"grabup"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Moduel etc.</p> <p>Moduel etc.</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"}></div> <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
</div>))} </div>))}
</div> </div>
@@ -374,14 +465,18 @@ export default function CalenderView(p) {
width: "100%", width: "100%",
gridRowStart: d.timestart, gridRowStart: d.timestart,
gridRowEnd: d.timeend, gridRowEnd: d.timeend,
backgroundColor: "#77932b" backgroundColor: getEntryColor(d.usercreatedbyid)
}} id={d.id + "e"}> }} id={d.id + "e"}>
<div className={"resize-grab"} id={"grabup"}></div> <div className={"resize-grab"} id={"grabup"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>Modul</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"}></div> <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
</div>))} </div>))}
</div> </div>
@@ -397,14 +492,18 @@ export default function CalenderView(p) {
width: "100%", width: "100%",
gridRowStart: d.timestart, gridRowStart: d.timestart,
gridRowEnd: d.timeend, gridRowEnd: d.timeend,
backgroundColor: "#77932b" backgroundColor: getEntryColor(d.usercreatedbyid)
}} id={d.id + "e"}> }} id={d.id + "e"}>
<div className={"resize-grab"} id={"grabup"}></div> <div className={"resize-grab"} id={"grabup"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
<div style={{maxHeight: "60%"}} className={"no-pointer-events"}> <div style={{maxHeight: "60%"}} className={"no-pointer-events"}>
<p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p> <p>{internal_to_time(d.timestart) + " - " + internal_to_time(d.timeend)}</p>
<p>Modul</p> <p>Modul</p>
</div> </div>
<div className={"resize-grab"} id={"grabdown"}></div> <div className={"resize-grab"} id={"grabdown"} style={{
backgroundColor: getResizeBarColor(d.usercreatedbyid)
}}></div>
</div>))} </div>))}
</div> </div>
</div> </div>
@@ -420,15 +519,15 @@ export default function CalenderView(p) {
justifyContent: "space-around", justifyContent: "space-around",
alignItems: "center", alignItems: "center",
}} className={"no-pointer-events"}> }} className={"no-pointer-events"}>
<div style={{ <div style={{
borderBottom: "1px solid #363636", borderBottom: "1px solid #363636",
}}><p style={{ }}><p style={{
color: "gray", color: "gray",
marginTop: cellHeight - 3, marginTop: cellHeight - 3,
marginRight: 120, marginRight: 120,
fontSize: 12, fontSize: 12,
textAlign: "center" textAlign: "center"
}}>{internal_to_time(i + 1)}</p></div> }}>{internal_to_time(i + 1)}</p></div>
<div style={{ <div style={{
borderBottom: "1px solid #363636", borderBottom: "1px solid #363636",
+1
View File
@@ -0,0 +1 @@
export const baseURL = "http://185.245.96.48:8080"
+6 -5
View File
@@ -2,6 +2,7 @@ import Button from "@/components/Button";
import {useRouter} from "next/router"; import {useRouter} from "next/router";
import {useEffect, useState} from "react"; import {useEffect, useState} from "react";
import Background from "@/components/Background"; import Background from "@/components/Background";
import {baseURL} from "@/components/Constants";
let userModuleMapping = new Map() let userModuleMapping = new Map()
@@ -29,12 +30,12 @@ export default function InputForm(p) {
async function getAllUsers() { async function getAllUsers() {
console.log("update") console.log("update")
let sessionid = localStorage.getItem("sessionid"); let sessionid = localStorage.getItem("sessionid");
let url = "http://localhost:8080/users/all?sessionid=" + sessionid; let url = baseURL + "/users/all?sessionid=" + sessionid;
await fetch(url).then(response => response.json()).then(async user => { await fetch(url).then(response => response.json()).then(async user => {
setUsers(user) setUsers(user)
let mURL = "http://localhost:8080/module/suid?sessionid=" + localStorage.getItem("sessionid") + "&semesterid=" + localStorage.getItem("currentsid") + "&userid="; let mURL = baseURL + "/module/suid?sessionid=" + localStorage.getItem("sessionid") + "&semesterid=" + localStorage.getItem("currentsid") + "&userid=";
for(let i = 0; i < user.length; i++) for(let i = 0; i < user.length; i++)
{ {
mURL += user[i].id; mURL += user[i].id;
@@ -127,7 +128,7 @@ export default function InputForm(p) {
"endyear": endYear "endyear": endYear
} }
let url = "http://localhost:8080/semester?sessionid=" + localStorage.getItem("sessionid"); let url = baseURL + "/semester?sessionid=" + localStorage.getItem("sessionid");
let method = p.courseName == null ? "POST" : "PUT"; let method = p.courseName == null ? "POST" : "PUT";
@@ -156,7 +157,7 @@ export default function InputForm(p) {
"activated": value.getActivated() "activated": value.getActivated()
} }
if (value.getChecked()) { if (value.getChecked()) {
let updateURL = "http://localhost:8080/module?sessionid=" + localStorage.getItem("sessionid"); let updateURL = baseURL + "/module?sessionid=" + localStorage.getItem("sessionid");
await fetch(updateURL, { await fetch(updateURL, {
method: method, method: method,
headers: {"Content-Type": "application/json"}, headers: {"Content-Type": "application/json"},
@@ -165,7 +166,7 @@ export default function InputForm(p) {
} }
else else
{ {
let deleteURL = "http://localhost:8080/module?sessionid=" + localStorage.getItem("sessionid") + let deleteURL = baseURL + "/module?sessionid=" + localStorage.getItem("sessionid") +
"&semesterid=" + semesterid + "&semesterid=" + semesterid +
"&userid=" + value.getUserid(); "&userid=" + value.getUserid();
await fetch(deleteURL, { await fetch(deleteURL, {
+3 -2
View File
@@ -3,10 +3,11 @@ import Button from "@/components/Button";
import {NextResponse} from "next/server"; import {NextResponse} from "next/server";
import Link from "next/link"; import Link from "next/link";
import {useRouter} from "next/router"; import {useRouter} from "next/router";
import {baseURL} from "@/components/Constants";
export default function Login() { export default function Login() {
let url = "http://localhost:8080/users" let url = baseURL + "/users"
async function on_login_click() { async function on_login_click() {
url += "?mail=" + inputUserName + "&password=" + inputPassword; url += "?mail=" + inputUserName + "&password=" + inputPassword;
@@ -20,7 +21,7 @@ export default function Login() {
if (value != "failed") { if (value != "failed") {
localStorage.setItem("sessionid", value); localStorage.setItem("sessionid", value);
url = "http://localhost:8080/users/check?sessionid=" + value; url = baseURL + "/users/check?sessionid=" + value;
fetch(url).then(r => r.json()).then(u => localStorage.setItem("userid", u.id)) fetch(url).then(r => r.json()).then(u => localStorage.setItem("userid", u.id))
let admin = 0 let admin = 0
await fetch(url).then(o => o.json()).then(user => { await fetch(url).then(o => o.json()).then(user => {
+2 -1
View File
@@ -1,5 +1,6 @@
import Button from "@/components/Button"; import Button from "@/components/Button";
import {useRouter} from "next/router"; import {useRouter} from "next/router";
import {baseURL} from "@/components/Constants";
export default function Logout() export default function Logout()
{ {
@@ -7,7 +8,7 @@ export default function Logout()
async function logout() async function logout()
{ {
let url = "http://localhost:8080/users/logout?sessionid=" + localStorage.getItem("sessionid"); let url = baseURL + "/users/logout?sessionid=" + localStorage.getItem("sessionid");
await fetch(url) await fetch(url)
await router.push("/") await router.push("/")
} }
+2 -1
View File
@@ -21,7 +21,8 @@ export default function SemesterTile(p)
lineHeight: "80%" lineHeight: "80%"
}}>{p.text}</p> }}>{p.text}</p>
<p style={{ <p style={{
lineHeight: "80%" lineHeight: "80%",
color: "gray"
}}>{p.text2}</p> }}>{p.text2}</p>
<StatusBar progress={0}/> <StatusBar progress={0}/>
<div style={{ <div style={{
+3 -2
View File
@@ -6,12 +6,13 @@ import {useRouter} from "next/router";
import PopUp from "@/components/PopUp"; import PopUp from "@/components/PopUp";
import Background from "@/components/Background"; import Background from "@/components/Background";
import Logout from "@/components/Logout"; import Logout from "@/components/Logout";
import {baseURL} from "@/components/Constants";
export default function SemesterOverview(p) export default function SemesterOverview(p)
{ {
async function getSemesters() async function getSemesters()
{ {
let urlTest = "http://localhost:8080/semester/all?sessionid=" + localStorage.getItem("sessionid"); let urlTest = baseURL + "/semester/all?sessionid=" + localStorage.getItem("sessionid");
await fetch(urlTest).then(response => response.json()).then(s => { await fetch(urlTest).then(response => response.json()).then(s => {
@@ -57,7 +58,7 @@ export default function SemesterOverview(p)
async function funcButtonDelete() async function funcButtonDelete()
{ {
let id = localStorage.getItem("currentsid"); let id = localStorage.getItem("currentsid");
let url = "http://localhost:8080/semester?sessionid=" + localStorage.getItem("sessionid") + "&id=" + id; let url = baseURL + "/semester?sessionid=" + localStorage.getItem("sessionid") + "&id=" + id;
await fetch(url, { await fetch(url, {
method: "DELETE" method: "DELETE"
}); });
@@ -6,11 +6,11 @@ import {useRouter} from "next/router";
import PopUp from "@/components/PopUp"; import PopUp from "@/components/PopUp";
import Background from "@/components/Background"; import Background from "@/components/Background";
import Logout from "@/components/Logout"; import Logout from "@/components/Logout";
import {baseURL} from "@/components/Constants"
export default function SemesteroverviewLecturer(p) { export default function SemesteroverviewLecturer(p) {
function getModules() { function getModules() {
let urlTest = "http://localhost:8080/module/id?sessionid=" + localStorage.getItem("sessionid"); let urlTest = baseURL + "/module/id?sessionid=" + localStorage.getItem("sessionid");
fetch(urlTest).then(response => response.json()).then(m => { fetch(urlTest).then(response => response.json()).then(m => {
setEntries(m); setEntries(m);
@@ -26,7 +26,7 @@ export default function SemesteroverviewLecturer(p) {
} }
let temp = [] let temp = []
let semesterURL = "http://localhost:8080/semester/id/all?ids=" + args + "&sessionid=" + localStorage.getItem("sessionid"); let semesterURL = baseURL + "/semester/id/all?ids=" + args + "&sessionid=" + localStorage.getItem("sessionid");
fetch(semesterURL).then(r => r.json()).then(sem => { fetch(semesterURL).then(r => r.json()).then(sem => {
sem.map(e => { sem.map(e => {
temp.push(e.name) temp.push(e.name)
+1 -2
View File
@@ -241,7 +241,7 @@ Popup
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
justify-content: end; justify-content: flex-end;
gap: 5px; gap: 5px;
} }
@@ -338,7 +338,6 @@ Calender View
height: 6px; height: 6px;
cursor: ns-resize; cursor: ns-resize;
width: 100%; width: 100%;
background-color: #5a6c20;
} }
Binary file not shown.
File diff suppressed because it is too large Load Diff