- updated notifications functionality;
This commit is contained in:
@@ -70,12 +70,12 @@ const NotificationsSidebar = () => {
|
||||
const role = pathOr('', ['role', 'roleType'], userData);
|
||||
|
||||
if (currentSubscription) {
|
||||
console.log('UNsubscribed')
|
||||
//console.log('UNsubscribed')
|
||||
currentSubscription.unsubscribe();
|
||||
setCurrentSubscription(null);
|
||||
}
|
||||
|
||||
if (isConnected && userData.id && chosenCompanyId !== 0 && role === 'ROLE_BENEFICIARY') {
|
||||
if (userData.id && chosenCompanyId !== 0 && role === 'ROLE_BENEFICIARY') {
|
||||
setLoading(true);
|
||||
NotificationService.getNotifications(
|
||||
userData.id,
|
||||
@@ -86,10 +86,10 @@ const NotificationsSidebar = () => {
|
||||
['companyId', chosenCompanyId]
|
||||
]
|
||||
);
|
||||
if (socket.current) {
|
||||
if (isConnected && socket.current) {
|
||||
subscribeTo(`/topic/notifications_user_${userData.id}_company_${chosenCompanyId}`)
|
||||
}
|
||||
} else if (isConnected && userData.id && role !== 'ROLE_BENEFICIARY') {
|
||||
} else if (userData.id && role !== 'ROLE_BENEFICIARY') {
|
||||
setLoading(true);
|
||||
NotificationService.getNotifications(
|
||||
userData.id,
|
||||
@@ -99,7 +99,7 @@ const NotificationsSidebar = () => {
|
||||
['status', status]
|
||||
]
|
||||
);
|
||||
if (socket.current) {
|
||||
if (isConnected && socket.current) {
|
||||
subscribeTo(`/topic/notifications_user_${userData.id}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user