resolve conflict
This commit is contained in:
@@ -80,9 +80,17 @@ export default function CalendarApp() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const [selectedCalendars, setSelectedCalendars] = useState<string[]>(
|
const [selectedCalendars, setSelectedCalendars] = useState<string[]>([]);
|
||||||
Object.keys(calendars).filter((id) => id.split("/")[0] === userId)
|
|
||||||
);
|
// 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);
|
const calendarRange = getCalendarRange(selectedDate);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import React, { useEffect } from "react";
|
|||||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||||
import { Auth } from "./oidcAuth";
|
import { Auth } from "./oidcAuth";
|
||||||
import { Loading } from "../../components/Loading/Loading";
|
import { Loading } from "../../components/Loading/Loading";
|
||||||
import { Error } from "../../components/Error/Error";
|
|
||||||
import { push } from "redux-first-history";
|
import { push } from "redux-first-history";
|
||||||
import { redirectTo } from "../../utils/apiUtils";
|
import { redirectTo } from "../../utils/apiUtils";
|
||||||
import { getOpenPaasUserDataAsync, setTokens, setUserData } from "./userSlice";
|
import { getOpenPaasUserDataAsync, setTokens, setUserData } from "./userSlice";
|
||||||
@@ -27,7 +26,7 @@ export function HandleLogin() {
|
|||||||
dispatch(setUserData(savedUser));
|
dispatch(setUserData(savedUser));
|
||||||
dispatch(getOpenPaasUserDataAsync());
|
dispatch(getOpenPaasUserDataAsync());
|
||||||
dispatch(getCalendarsListAsync());
|
dispatch(getCalendarsListAsync());
|
||||||
dispatch(push("/"));
|
dispatch(push("/calendar"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user