Compare commits
1 Commits
split-full
...
saad/INF-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
367007f5d6 |
@@ -14,7 +14,7 @@ import {
|
|||||||
selectUpdatePreferencesStatus,
|
selectUpdatePreferencesStatus,
|
||||||
} from './data/selectors';
|
} from './data/selectors';
|
||||||
import NotificationPreferenceRow from './NotificationPreferenceRow';
|
import NotificationPreferenceRow from './NotificationPreferenceRow';
|
||||||
import { updateAppPreferenceToggle, updateChannelPreferenceToggle } from './data/thunks';
|
import { updatePreferenceToggle } from './data/thunks';
|
||||||
import { LOADING_STATUS } from '../constants';
|
import { LOADING_STATUS } from '../constants';
|
||||||
import NOTIFICATION_CHANNELS from './data/constants';
|
import NOTIFICATION_CHANNELS from './data/constants';
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ const NotificationPreferenceApp = ({ appId }) => {
|
|||||||
(preference) => preference[notificationChannel] && !isPreferenceNonEditable(preference),
|
(preference) => preference[notificationChannel] && !isPreferenceNonEditable(preference),
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatch(updateChannelPreferenceToggle(courseId, appId, notificationChannel, !hasActivePreferences));
|
dispatch(updatePreferenceToggle(courseId, appId, notificationChannel, !hasActivePreferences));
|
||||||
}, [appId, appPreferences, courseId, dispatch, nonEditable]);
|
}, [appId, appPreferences, courseId, dispatch, nonEditable]);
|
||||||
|
|
||||||
const preferences = useMemo(() => (
|
const preferences = useMemo(() => (
|
||||||
|
|||||||
@@ -149,15 +149,3 @@ export const updatePreferenceToggle = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const updateChannelPreferenceToggle = (courseId, notificationApp, notificationChannel, value) => (
|
|
||||||
async (dispatch) => {
|
|
||||||
try {
|
|
||||||
const data = await patchChannelPreferenceToggle(courseId, notificationApp, notificationChannel, value);
|
|
||||||
const normalizedData = normalizePreferences(camelCaseObject(data));
|
|
||||||
dispatch(fetchNotificationPreferenceSuccess(courseId, normalizedData));
|
|
||||||
} catch (errors) {
|
|
||||||
dispatch(fetchNotificationPreferenceFailed());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user