1 import { selectUserSettings } from '@proton/account';
2 import type { SharedStartListening } from '@proton/redux-shared-store-types';
3 import { CacheType } from '@proton/redux-utilities';
5 import type { HolidaysDirectoryState } from './index';
6 import { holidaysDirectoryThunk, selectHolidaysDirectory } from './index';
8 export const startHolidaysDirectoryListener = (startListening: SharedStartListening<HolidaysDirectoryState>) => {
10 predicate: (action, currentState, previousState) => {
11 const currentCalendars = selectHolidaysDirectory(currentState);
12 if (!currentCalendars?.value) {
15 const currentUserSettings = selectUserSettings(currentState).value;
16 const previousUserSettings = selectUserSettings(previousState).value;
17 return Boolean(previousUserSettings?.Locale && currentUserSettings?.Locale !== previousUserSettings.Locale);
19 effect: async (action, listenerApi) => {
20 listenerApi.dispatch(holidaysDirectoryThunk({ cache: CacheType.None }));