diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 09e9c1e..46f00a9 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -3,6 +3,7 @@ import Login from "./pages/Login";
import Tasks from "./pages/Tasks";
import Profile from "./pages/Profile";
import ChangePassword from "./pages/ChangePassword";
+import DeleteAccount from "./pages/DeleteAccount";
const App = () => {
return (
@@ -12,6 +13,7 @@ const App = () => {
} />
} />
} />
+ } />
);
diff --git a/frontend/src/pages/DeleteAccount.tsx b/frontend/src/pages/DeleteAccount.tsx
new file mode 100644
index 0000000..f1ab7dc
--- /dev/null
+++ b/frontend/src/pages/DeleteAccount.tsx
@@ -0,0 +1,55 @@
+import { useNavigate, useParams } from "react-router-dom";
+import { useState } from "react";
+import api from "../api/api";
+import { logout } from "../api/auth";
+
+const DeleteAccount = () => {
+ const navigate = useNavigate();
+ const { id } = useParams();
+ const [confirmation, setConfirmation] = useState("");
+ const [error, setError] = useState("");
+
+ const handleDelete = async () => {
+ try {
+ await api.delete(`/users/${id}`);
+ await logout();
+ navigate("/login");
+ } catch (err: any) {
+ console.error(err);
+ setError("Wystąpił błąd podczas usuwania konta.");
+ }
+ };
+
+ return (
+
+
⚠️ Usuń konto
+
+ Tej operacji nie można cofnąć. Aby potwierdzić, wpisz USUŃ poniżej:
+
+
+
setConfirmation(e.target.value)}
+ className="border p-2 rounded w-full mb-4"
+ />
+
+
+
+ {error &&
{error}
}
+
+ );
+};
+
+export default DeleteAccount;