mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-18 21:44:07 +01:00
Send delete when delete in calendar
This commit is contained in:
parent
11601df6a3
commit
86c8af32e9
@ -4,7 +4,7 @@ let eventGuid = 0;
|
||||
|
||||
const mapResponseToEvents = response => {
|
||||
return response.map(item => ({
|
||||
id: createEventId(),
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
start: item.start_event,
|
||||
end: item.end_event,
|
||||
|
||||
@ -5,6 +5,7 @@ import dayGridPlugin from "@fullcalendar/daygrid";
|
||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||
import interactionPlugin from "@fullcalendar/interaction";
|
||||
import { getEvents, createEventId } from "./TaskDataHandler";
|
||||
import axiosInstance from "../../api/configs/AxiosConfig";
|
||||
|
||||
export default class Calendar extends React.Component {
|
||||
state = {
|
||||
@ -101,7 +102,14 @@ export default class Calendar extends React.Component {
|
||||
|
||||
handleEventClick = clickInfo => {
|
||||
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
|
||||
clickInfo.event.remove();
|
||||
axiosInstance
|
||||
.delete(`todo/${clickInfo.event.id}/`)
|
||||
.then(response => {
|
||||
clickInfo.event.remove();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error deleting Task:", error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user