- updated notifications functionality;
This commit is contained in:
@@ -8,7 +8,7 @@ import { isEmpty } from 'ramda';
|
||||
import '@xyflow/react/dist/style.css';
|
||||
|
||||
// store
|
||||
import { useStore, storeSet, storeGet } from '../../store';
|
||||
import { useStore, storeSet } from '../../store';
|
||||
|
||||
// nodes
|
||||
import NodeInitialForm from './components/NodeInitialForm';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { isEmpty, isNil } from 'ramda';
|
||||
import { isNil } from 'ramda';
|
||||
|
||||
// components
|
||||
import { Controller } from 'react-hook-form';
|
||||
|
||||
@@ -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