[#168] added refresh to temp calendars when updating

This commit is contained in:
Camille Moussu
2025-10-15 15:20:15 +02:00
committed by Benoit TELLIER
parent 0f82711d7d
commit 29f984b347
10 changed files with 151 additions and 68 deletions
+6 -2
View File
@@ -6,6 +6,7 @@ import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { ThunkDispatch } from "@reduxjs/toolkit";
import {
emptyTempCal,
getCalendarDetailAsync,
getCalendarsListAsync,
} from "../../../features/Calendars/CalendarSlice";
@@ -114,9 +115,11 @@ export function stringAvatar(name: string) {
export async function refreshCalendars(
dispatch: ThunkDispatch<any, any, any>,
calendars: Calendars[],
calendarRange: { start: Date; end: Date }
calendarRange: { start: Date; end: Date },
calType?: "temp"
) {
await dispatch(getCalendarsListAsync());
!calType && (await dispatch(getCalendarsListAsync()));
calType && dispatch(emptyTempCal());
calendars.map(
async (cal) =>
@@ -127,6 +130,7 @@ export async function refreshCalendars(
start: formatDateToYYYYMMDDTHHMMSS(calendarRange.start),
end: formatDateToYYYYMMDDTHHMMSS(calendarRange.end),
},
calType,
})
)
);