444 use websocket to trigger reloads (#458)
* [#444] added refresh on sync token calendar update * [#444] added refresh on register and tests * [#444] extracted logic for useEffects and updates * [#444] refactored code structure to use absolute paths
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { RootState } from "../app/store";
|
||||
import { Calendar } from "../features/Calendars/CalendarTypes";
|
||||
|
||||
export function findCalendarById(
|
||||
state: Partial<RootState>,
|
||||
calendarId: string
|
||||
): { calendar: Calendar; type?: "temp" } | undefined {
|
||||
if (calendarId.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (state.calendars?.list?.[calendarId]) {
|
||||
return { calendar: state.calendars.list[calendarId] };
|
||||
}
|
||||
if (state.calendars?.templist?.[calendarId]) {
|
||||
return { calendar: state.calendars.templist[calendarId], type: "temp" };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user