Fondation
This commit is contained in:
parent
2ec888892c
commit
901f81e8f7
@ -22,25 +22,23 @@ type Event = {
|
||||
};
|
||||
|
||||
export function CalendarWidget() {
|
||||
const sessionResult = useSession();
|
||||
const { data: session } = sessionResult;
|
||||
const [events, setEvents] = useState<Event[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const { triggerNotification } = useWidgetNotification();
|
||||
const lastEventCountRef = useRef<number>(-1);
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
useEffect(() => {
|
||||
const currentStatus = sessionResult.status;
|
||||
console.log("Calendar Widget - Session Status:", currentStatus);
|
||||
console.log("Calendar Widget - Session Status:", status);
|
||||
console.log("Calendar Widget - Session Data:", session);
|
||||
|
||||
if (currentStatus === "loading") {
|
||||
if (status === "loading") {
|
||||
console.log("Calendar Widget - Session is loading");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentStatus !== "authenticated" || !session) {
|
||||
if (status !== "authenticated" || !session) {
|
||||
console.log("Calendar Widget - Not authenticated, skipping fetch");
|
||||
setLoading(false);
|
||||
return;
|
||||
@ -201,7 +199,7 @@ export function CalendarWidget() {
|
||||
}, 300000);
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
}, [session, sessionResult.status, triggerNotification]);
|
||||
}, [session, status, triggerNotification]);
|
||||
|
||||
const formatEventDate = (date: Date, isAllDay: boolean) => {
|
||||
let dateString = "";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user