[#30] Load data for the current month

This commit is contained in:
Camille Moussu
2025-07-09 11:53:53 +02:00
parent 875fea095f
commit 2281580c4b
4 changed files with 74 additions and 26 deletions
+6 -4
View File
@@ -32,9 +32,9 @@ export const getCalendarsListAsync = createAsyncThunk<
export const getCalendarDetailAsync = createAsyncThunk<
{ calId: string; events: CalendarEvent[] }, // Return type
{ access_token: string; calId: string } // Arg type
>("calendars/getCalendarDetails", async ({ access_token, calId }) => {
const calendar = await getCalendar(calId, access_token);
{ access_token: string; calId: string; match: { start: string; end: string } } // Arg type
>("calendars/getCalendarDetails", async ({ access_token, calId, match }) => {
const calendar = await getCalendar(calId, access_token, match);
const color = calendar["apple:color"];
const events: CalendarEvent[] = calendar._embedded["dav:item"].map(
(eventdata: any) => {
@@ -104,7 +104,9 @@ const CalendarSlice = createSlice({
events: [] as CalendarEvent[],
} as Calendars;
}
state.list[action.payload.calId].events = action.payload.events;
action.payload.events.forEach((event) => {
state.list[action.payload.calId].events.push(event);
});
state.list[action.payload.calId].events.forEach((event) => {
event.color = state.list[action.payload.calId].color;
});