diff --git a/src/components/Notifications/HandlerNotification.js b/src/components/Notifications/HandlerNotification.js
index 3c394f6cd..3ab177b1f 100644
--- a/src/components/Notifications/HandlerNotification.js
+++ b/src/components/Notifications/HandlerNotification.js
@@ -1,8 +1,9 @@
-import React, { useState, useEffect, useCallback } from 'react';
+import React, { useState, useEffect, useCallback, useContext } from 'react';
import toast, { Toaster } from 'react-hot-toast';
import { onMessageListener } from '../../firebase';
import { AiOutlineClose } from 'react-icons/ai';
import logo from '../../assets/images/logo.png';
+import CredentialsContext from '../../context/CredentialsContext';
const ToastDisplay = ({ id, notification }) => {
return (
@@ -31,6 +32,7 @@ const ToastDisplay = ({ id, notification }) => {
const HandlerNotification = () => {
const [notification, setNotification] = useState({ title: '', body: '' });
+ const { getData } = useContext(CredentialsContext);
const showToast = useCallback(
() => toast((t) => ),
@@ -50,6 +52,7 @@ const HandlerNotification = () => {
title: payload?.notification?.title,
body: payload?.notification?.body,
});
+ getData();
})
.catch((err) => {
console.log('Failed to receive message:', err);
@@ -60,10 +63,10 @@ const HandlerNotification = () => {
messageListener();
}
};
- }, []);
+ }, [getData]);
return (
-
+
);
};