- beneficiary notifications pagination added;
This commit is contained in:
@@ -88,35 +88,24 @@ const NotificationsSidebar = () => {
|
||||
const bodyParams = getPaginationQuery(status, currentPage);
|
||||
|
||||
if (currentSubscription) {
|
||||
//console.log('UNsubscribed')
|
||||
currentSubscription.unsubscribe();
|
||||
setCurrentSubscription(null);
|
||||
}
|
||||
|
||||
if (userData.id && chosenCompanyId !== 0 && role === 'ROLE_BENEFICIARY') {
|
||||
setLoading(true);
|
||||
NotificationService.getNotificationsByCompanyId(
|
||||
NotificationService.getNotificationsByCompanyIdPagination(
|
||||
userData.id,
|
||||
chosenCompanyId,
|
||||
status === 'UNREAD' ? getNotifications : getNotificationsRead,
|
||||
errGetNotifications,
|
||||
[
|
||||
['status', status]
|
||||
]
|
||||
bodyParams,
|
||||
status === 'UNREAD' ? getNotificationsPagi : getNotificationsReadPagi,
|
||||
errGetNotifications
|
||||
);
|
||||
if (isConnected && socket.current) {
|
||||
subscribeTo(`/topic/notifications_user_${userData.id}_company_${chosenCompanyId}`)
|
||||
}
|
||||
} else if (userData.id && role !== 'ROLE_BENEFICIARY') {
|
||||
setLoading(true);
|
||||
/*NotificationService.getNotifications(
|
||||
userData.id,
|
||||
status === 'UNREAD' ? getNotifications : getNotificationsRead,
|
||||
errGetNotifications,
|
||||
[
|
||||
['status', status]
|
||||
]
|
||||
);*/
|
||||
NotificationService.getNotificationsPagination(
|
||||
userData.id,
|
||||
bodyParams,
|
||||
@@ -157,24 +146,6 @@ const NotificationsSidebar = () => {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const getNotifications = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
setNotifications(resp.data);
|
||||
setTotalRecordsNum(resp.data.length);
|
||||
}
|
||||
set404FromErrorResponse(resp);
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const getNotificationsRead = (resp) => {
|
||||
if (resp.status === 'SUCCESS') {
|
||||
setNotificationsRead(resp.data);
|
||||
setTotalRecordsNum(resp.data.length);
|
||||
}
|
||||
set404FromErrorResponse(resp);
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const errGetNotifications = (resp) => {
|
||||
set404FromErrorResponse(resp);
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user