mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-20 06:24: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 => {
|
const mapResponseToEvents = response => {
|
||||||
return response.map(item => ({
|
return response.map(item => ({
|
||||||
id: createEventId(),
|
id: item.id,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
start: item.start_event,
|
start: item.start_event,
|
||||||
end: item.end_event,
|
end: item.end_event,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import dayGridPlugin from "@fullcalendar/daygrid";
|
|||||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||||
import interactionPlugin from "@fullcalendar/interaction";
|
import interactionPlugin from "@fullcalendar/interaction";
|
||||||
import { getEvents, createEventId } from "./TaskDataHandler";
|
import { getEvents, createEventId } from "./TaskDataHandler";
|
||||||
|
import axiosInstance from "../../api/configs/AxiosConfig";
|
||||||
|
|
||||||
export default class Calendar extends React.Component {
|
export default class Calendar extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
@ -101,7 +102,14 @@ export default class Calendar extends React.Component {
|
|||||||
|
|
||||||
handleEventClick = clickInfo => {
|
handleEventClick = clickInfo => {
|
||||||
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
|
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
|
||||||
|
axiosInstance
|
||||||
|
.delete(`todo/${clickInfo.event.id}/`)
|
||||||
|
.then(response => {
|
||||||
clickInfo.event.remove();
|
clickInfo.event.remove();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("Error deleting Task:", error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user