resolve conflict

This commit is contained in:
lenhanphung
2025-09-18 15:50:10 +07:00
parent 8a7d2f742a
commit cddebad9b7
2 changed files with 12 additions and 5 deletions
+11 -3
View File
@@ -80,9 +80,17 @@ export default function CalendarApp() {
);
}
});
const [selectedCalendars, setSelectedCalendars] = useState<string[]>(
Object.keys(calendars).filter((id) => id.split("/")[0] === userId)
);
const [selectedCalendars, setSelectedCalendars] = useState<string[]>([]);
// Auto-select personal calendars when first loaded
useEffect(() => {
if (Object.keys(calendars).length > 0 && userId && selectedCalendars.length === 0) {
const personalCalendarIds = Object.keys(calendars).filter(
(id) => id.split("/")[0] === userId
);
setSelectedCalendars(personalCalendarIds);
}
}, [calendars, userId, selectedCalendars.length]);
const calendarRange = getCalendarRange(selectedDate);
+1 -2
View File
@@ -2,7 +2,6 @@ import React, { useEffect } from "react";
import { useAppDispatch, useAppSelector } from "../../app/hooks";
import { Auth } from "./oidcAuth";
import { Loading } from "../../components/Loading/Loading";
import { Error } from "../../components/Error/Error";
import { push } from "redux-first-history";
import { redirectTo } from "../../utils/apiUtils";
import { getOpenPaasUserDataAsync, setTokens, setUserData } from "./userSlice";
@@ -27,7 +26,7 @@ export function HandleLogin() {
dispatch(setUserData(savedUser));
dispatch(getOpenPaasUserDataAsync());
dispatch(getCalendarsListAsync());
dispatch(push("/"));
dispatch(push("/calendar"));
return;
}