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