[Vuejs]-Flatpickr redraws the days list after selecting a day and all changes made with onDayCreate are lost

0๐Ÿ‘

I found the answer. I need to add a condition if the month has not changed.

if (this.currentMonth !== month) {
    this.updateDataProcess = true;

    new Promise((onSuccess, onError) => {
        request.requestData({
            data: 'Calendar\\BusyDaysForMonth',
            arguments: {
                appointment_id: 0,
                month,
                extended: true,
            },
        },
        (response) => { onSuccess(response) },
        (error) => { onError(error) });
    }).then(
        (response) => {
            this.updateDataProcess = false;

            this.currentMonth = month;
            this.busyDaysData = response.data;
            this.handleDay(dayDay, dayElem);
        },
        (error) => {
            this.updateDataProcess = false;
            console.log(error);
        }
    );
} else {
    this.handleDay(dayDay, dayElem);
}

Leave a comment