feat: added notification tray

This commit is contained in:
SundasNoreen
2023-05-19 16:17:50 +05:00
parent a5069edd94
commit f8fc794458
28 changed files with 981 additions and 312 deletions

View File

@@ -0,0 +1,36 @@
import {
fetchNotificationSuccess,
fetchNotificationRequest,
fetchNotificationFailure,
fetchNotificationsCountFailure,
fetchNotificationsCountRequest,
fetchNotificationsCountSuccess,
} from './slice';
import {
getNotifications,
getNotificationCounts,
} from './api';
export const fetchNotificationList = ({ notificationType }) => (
async (dispatch) => {
try {
dispatch(fetchNotificationRequest({ notificationType }));
const data = await getNotifications(notificationType);
dispatch(fetchNotificationSuccess(data));
} catch (errors) {
dispatch(fetchNotificationFailure({ notificationType }));
}
}
);
export const fetchNotificationsCountsList = () => (
async (dispatch) => {
try {
dispatch(fetchNotificationsCountRequest());
const data = await getNotificationCounts();
dispatch(fetchNotificationsCountSuccess(data));
} catch (errors) {
dispatch(fetchNotificationsCountFailure());
}
}
);