use pendingMembers context

This commit is contained in:
2026-02-22 16:20:31 +01:00
parent fe1948e632
commit c95f8cfae7
3 changed files with 16 additions and 26 deletions
+4 -2
View File
@@ -10,6 +10,7 @@ import { userNotificationsListener } from "../../utils/echo/listeners/userNotifi
import NotificationCard from "../NotificationCard/NotificationCard.jsx";
import { EventContext } from "../../contexts/events/EventContext.js";
import {AuthContext} from "../../contexts/auth/AuthContext.js";
import { PendingMembersContext } from "../../contexts/pendingMembers/PendingMembersContext";
function Header() {
@@ -20,6 +21,7 @@ function Header() {
const [mobileMenu, setMobileMenu] = useState(false);
const [notifications, setNotifications] = useState([]);
const notificationRef = useRef(null);
const { updatePendingMembers } = useContext(PendingMembersContext);
useEffect(() => {
@@ -41,7 +43,7 @@ function Header() {
echoInstance = echo;
const activeChannels = [
userCreatedListener(echo, user, setNotifications, setunreadNotification),
userCreatedListener(echo, user, setNotifications, setunreadNotification, updatePendingMembers),
userNotificationsListener(echo, user, setNotifications, setunreadNotification),
];
channelsToLeave = activeChannels.filter(name => name !== null);
@@ -86,7 +88,7 @@ function Header() {
}
}
} catch (err) {
console.error('Erreur suppression notification :', err);
console.error('Erreur pour ouvrir/fermer le menu de notifications :', err);
}
}