refactor recurring event modification (#173)
This commit is contained in:
@@ -4,7 +4,14 @@ import Avatar from "@mui/material/Avatar";
|
||||
import Badge from "@mui/material/Badge";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { ThunkDispatch } from "@reduxjs/toolkit";
|
||||
import {
|
||||
getCalendarDetailAsync,
|
||||
getCalendarsListAsync,
|
||||
} from "../../../features/Calendars/CalendarSlice";
|
||||
import { Calendars } from "../../../features/Calendars/CalendarTypes";
|
||||
import { userAttendee } from "../../../features/User/userDataTypes";
|
||||
import { formatDateToYYYYMMDDTHHMMSS } from "../../../utils/dateUtils";
|
||||
|
||||
export function renderAttendeeBadge(
|
||||
a: userAttendee,
|
||||
@@ -103,3 +110,24 @@ export function stringAvatar(name: string) {
|
||||
children: name[0],
|
||||
};
|
||||
}
|
||||
|
||||
export async function refreshCalendars(
|
||||
dispatch: ThunkDispatch<any, any, any>,
|
||||
calendars: Calendars[],
|
||||
calendarRange: { start: Date; end: Date }
|
||||
) {
|
||||
await dispatch(getCalendarsListAsync());
|
||||
|
||||
calendars.map(
|
||||
async (cal) =>
|
||||
await dispatch(
|
||||
getCalendarDetailAsync({
|
||||
calId: cal.id,
|
||||
match: {
|
||||
start: formatDateToYYYYMMDDTHHMMSS(calendarRange.start),
|
||||
end: formatDateToYYYYMMDDTHHMMSS(calendarRange.end),
|
||||
},
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user