@@ -61,14 +61,8 @@ const Occupied = React.memo(() => {
61
61
useEffect ( ( ) => {
62
62
setServicesData ( [ ] ) ;
63
63
getApplications ( ) ;
64
- // update communication data from last visited database
65
- for ( const app of applications ) {
66
- const temp = commsData ;
67
- const newComm = fetchCommsData ( '' , true ) ;
68
- setCommsData ( [ ...temp , newComm ] )
69
- }
70
64
} , [ ] ) ;
71
-
65
+
72
66
// Ask user for deletetion confirmation
73
67
const confirmDelete = ( event : ClickEvent , app : string , i : number ) => {
74
68
const message = `The application '${ app } ' will be permanently deleted. Continue?` ;
@@ -194,6 +188,10 @@ const Occupied = React.memo(() => {
194
188
} ) ) ;
195
189
196
190
let classes = ( mode === 'light mode' ) ? useStylesLight ( { } as StyleProps ) : useStylesDark ( { } as StyleProps ) ;
191
+
192
+ // update notification count based on statuscode >= 400
193
+ const notification = commsData . filter ( ( item : { responsestatus : number ; } ) => item . responsestatus >= 400 )
194
+
197
195
return (
198
196
< div className = "entireArea" >
199
197
< div className = "dashboardArea" >
@@ -223,9 +221,9 @@ const Occupied = React.memo(() => {
223
221
224
222
225
223
< div className = "notificationsIconArea" >
226
- < span className = "notificationsTooltip" > You have { commsData . length } new alerts</ span >
224
+ < span className = "notificationsTooltip" > You have { notification ? notification . length : 0 } new alerts</ span >
227
225
< NotificationsIcon className = "navIcon" id = "notificationsIcon" />
228
- < Badge badgeContent = { commsData . length } color = "secondary" />
226
+ < Badge badgeContent = { notification ? notification . length : 0 } color = "secondary" />
229
227
</ div >
230
228
231
229
0 commit comments