26 lines
553 B
TypeScript
26 lines
553 B
TypeScript
"use client";
|
|
|
|
import Planning from "@/components/planning";
|
|
import { useApi } from "@/hooks/use-api";
|
|
import ICalendarEvent from "@/interfaces/ICalendarEvent";
|
|
import { Loader2 } from "lucide-react";
|
|
|
|
export default function Page() {
|
|
const {
|
|
data: requestedEvents,
|
|
isLoading,
|
|
success,
|
|
mutate,
|
|
} = useApi<ICalendarEvent[]>("/events", undefined, false, false);
|
|
|
|
if (isLoading) return <Loader2 className="animate-spin" />;
|
|
if (success)
|
|
return (
|
|
<Planning
|
|
modifiable
|
|
events={requestedEvents ?? []}
|
|
mutate={mutate}
|
|
/>
|
|
);
|
|
}
|