Files
TIF22A_AnwProjekt_B/anwendung/src/components/SubmitWarning.jsx
T
2023-06-16 12:13:20 +02:00

56 lines
1.7 KiB
React

import {baseURL} from "@/components/Constants";
import Button from "@/components/Button";
export default function SubmitWarning(p){
async function submit() {
let url = baseURL + "/module?sessionid=" + localStorage.getItem("sessionid");
let json1 = {
"id": localStorage.getItem("moduleid"),
"userid": localStorage.getItem("userid"),
"semesterid": localStorage.getItem("currentsid"),
"name": localStorage.getItem("currentmodulename"),
"activated": 0
}
await fetch(url, {
method: "PUT",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(json1)
})
p.onClick();
p.onClick();
}
return (
<div className="box-shadow" style={{
position: "absolute",
top: 300,
left: 0,
right: 0,
borderRadius: 5,
textAlign: "center",
fontSize: 20,
margin: "auto",
width: 600
}}>
<p style={{paddingTop: 20, paddingBottom: 5}}>Möchten Sie wirklich abgeben?</p>
<p>Danach können Sie keine Änderungen mehr vornehmen!</p>
<div style={{
display: "flex",
flexDirection: "row",
justifyContent: "center",
paddingTop: 40,
paddingBottom: 20
}}>
<Button onClick={() => submit()} text={"Bestätigen"} color={"#77932b"} width={100} height={40} />
<div style={{width: 20}}></div>
<Button onClick={() => p.onClick()} text={"Abbrechen"} color={"red"} width={100} height={40} />
</div>
</div>
)
}