nhn/tui.calendar

Ajax post in beforeCreateEvent gives error: "Cannot read properties of undefined (reading 'd')"

WouterBosch opened this issue · 1 comments

Version

version 2.1.3

Test Environment

Chrome, Windows 10

Current Behavior

NEVERMIND MADE A DUMB MISTAKE. I WOULD DELETE THIS IF I KNEW HOW
To save the event to the database I want to make an ajax call to an endpoint that creates the event in the database before adding it to the calendar.

  1. beforeCreateEvent is called.
  2. Test is printed to the console
  3. As soon as it hits the ajax call "Uncaught TypeError: Cannot read properties of undefined (reading 'd')" is printed to the console.

The issue seems to stem from the eventobj as the call works as long as I dont put the eventobj in the data

image

  calendar.on("beforeCreateEvent", (eventObj) => {
        console.log("test");

        jQuery.ajax({
            type: "POST",
            url: "/calendar/createEvent",
            data: eventObj,
            dataType: "JSON",
            success: function (data) {
                calendar.createEvents([
                    {
                        ...eventObj,
                        id: data.uuid,
                    },
                ]);
            },
            error: function (data) {
                alertify.alert(
                    "Something has gone wrong. Please try again later."
                );
            },
            complete: function () {
                calendar.clearGridSelections();
            },
        });
    });

Expected Behavior

The ajax call is executed and on success it creates an event in the calendar