aldabil21/react-scheduler

Remote Data not displaying on the Calendar

Closed this issue · 1 comments

I am trying to fetch some remote data and it is not displaying, but when I use the sample response in a static file I am able to see the data.

const TimeSlots: React.FC = () => {
  const calendarRef = useRef<SchedulerRef>(null);
  const { data, isSuccess } = useGetEvents();
  const convertedAppointments: any = isSuccess
    ? data.appointments.map((appointment: any) => ({
        ...appointment,
        start: new Date(appointment.start),
        end: new Date(appointment.end),
      }))
    : [];

  const fetchRemote = async () => {
    const data = await convertedAppointments;
    return data;
  };
  return (
    <Fragment>
      <Scheduler
        ref={calendarRef}
        getRemoteEvents={fetchRemote}
        deletable={false}
      />
      <div>{stringDat}</div>
    </Fragment>
  );
};

export default TimeSlots;

I was able so solve it. NO issue with library.