onBeforeTaskDelete doesn't wait on http response

Currently, what I’m trying to do is request a delete on server first before deleting the task on frontend but it seems it doesnt wait on the http request.
Unlike onBeforeTaskAdd which respect my http request. it will block when I have an error on the server side.

gantt.attachEvent("onBeforeTaskDelete", function (id, item) {
    return axios.post('/timelines/task/' + id, {
                    "_method": "DELETE"
                })
                .then(function (response) {
                    return true
                })
                .catch(function (error) {
                    gantt.alert({
                        title: "Error",
                        text: "Something went wrong.",
                        ok: "Ok",
                    });
                    // gantt.detachEvent(attachOnBeforeTaskAdd)
                    // gantt.addTask(item, item.parent, item.$index)
                    // gantt.attachEvent(attachOnBeforeTaskAdd)
                    return false
                })
})

that is my code and it doesn’t work as expected unlike the onBeforeTaskAdd which really block or wait for the return true or false. I also try to do async but it doesnt work also.

Hello Carl,
Not all events are asynchronous. If I try to apply the code in the onBeforeTaskAdd event to rely on a function return value, the task is still added on the client site regardless of the response:
http://snippet.dhtmlx.com/6d86cbafd

To make it work for the onBeforeTaskDelete event, you need to use an additional variable that will determine if the task should be deleted or not.
Here is an example of how it might be implemented:
http://snippet.dhtmlx.com/51484cec9