From e32a432b7a2ff97616c43a0c101c617af9ce9160 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Tue, 1 Aug 2023 22:35:15 +0200 Subject: [PATCH] Created the Delete.jsx settings component --- .../Settings/components/Delete/Delete.jsx | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/states/Dashboard/pages/Info/components/Settings/components/Delete/Delete.jsx diff --git a/src/states/Dashboard/pages/Info/components/Settings/components/Delete/Delete.jsx b/src/states/Dashboard/pages/Info/components/Settings/components/Delete/Delete.jsx new file mode 100644 index 0000000..cd31c27 --- /dev/null +++ b/src/states/Dashboard/pages/Info/components/Settings/components/Delete/Delete.jsx @@ -0,0 +1,29 @@ +import {Box, Button, Typography} from "@mui/material"; +import {Delete as DeleteIcon} from "@mui/icons-material"; +import {deleteRequest} from "@/common/utils/RequestUtil.js"; +import {useContext} from "react"; +import {ProjectContext} from "@/states/Dashboard/contexts/Project"; + +export const Delete = () => { + const {currentProject, updateProjects} = useContext(ProjectContext); + const deleteProject = async () => { + try { + await deleteRequest(`/project/${currentProject.id}`); + await updateProjects(); + } catch (e) { + console.error(e); + } + } + + return ( + + Projekt löschen + + Diese Aktion kann nicht Rückgängig gemacht + werden. Ich hoffe du weißt, was du tust. + + + + + ) +} \ No newline at end of file