diff --git a/frontend/src/components/pages/SkillTree/SkillTree.tsx b/frontend/src/components/pages/SkillTree/SkillTree.tsx
index e045191..15408ec 100644
--- a/frontend/src/components/pages/SkillTree/SkillTree.tsx
+++ b/frontend/src/components/pages/SkillTree/SkillTree.tsx
@@ -1,10 +1,9 @@
import { Input } from "../../ui/input";
-import VacancyCard from "../../entities/VacancyCard/VacancyCard";
import { Textarea } from "../../shared/ui/textarea";
import { Button } from "../../shared/ui/button";
import less from "./SkillTree.module.less"
import { Switch } from "../../shared/ui/switch";
-import { addEvent, submitRegister } from "../../widgets/Header/AuthAPI";
+import { addEvent, deleteEvent, submitRegister } from "../../widgets/Header/AuthAPI";
import {
Card,
CardContent,
@@ -62,8 +61,8 @@ const SkillTree = () => {
{event.title}
Дата начала: {event.start_date}
- {false && (
-
+ {true && (
+
)}
diff --git a/frontend/src/components/widgets/Header/AuthAPI.ts b/frontend/src/components/widgets/Header/AuthAPI.ts
index d27fcd9..fa6b506 100644
--- a/frontend/src/components/widgets/Header/AuthAPI.ts
+++ b/frontend/src/components/widgets/Header/AuthAPI.ts
@@ -105,3 +105,31 @@ export const addEvent = (e: FormEvent) => {
console.error('Возникла ошибка с регой:', error);
});
}
+export const deleteEvent = (id:string) => {
+
+ fetch(`${API_BASE}${API_EVENT}${id}`, {
+ method: "DELETE",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ })
+ .then(response => {
+ console.log(response.status);
+ if (response.ok) {
+ console.log('Удален:', response.headers.get('Location'));
+ window.location.reload();
+ return response.json();
+ } else {
+ return response.text().then(errorMessage => {
+ throw new Error('Код ошибки: ' + response.status + '. ' + errorMessage + '. Дата ошибки: ' + response.headers.get('Date'));
+ });
+ }
+ })
+ .then(data => {
+ console.log('Успешно:', data);
+ })
+ .catch(error => {
+ console.error('Возникла ошибка с удалением:', error);
+ });
+}
+