multiplex user notifications over a single private channel

This commit is contained in:
2026-01-11 12:10:44 +01:00
parent 5fb97ccd90
commit c906cb733e
2 changed files with 50 additions and 2 deletions
+7 -2
View File
@@ -1,13 +1,17 @@
import styles from "./Header.module.css"
import { Link, NavLink } from "react-router";
import {useContext, useEffect, useRef, useState} from "react";
import {AuthContext} from "../../contexts/auth/AuthContext.js";
import styles from "./Header.module.css"
import getUserNotifications from "../../utils/notifications/getUserNotifications.js";
import deleteNotificationUser from "../../utils/notifications/deleteNotificationUser.js";
import initEcho from "../../utils/echo/initEcho.js"
import readNotifications from "../../utils/notifications/readNotifications.js";
import {AuthContext} from "../../contexts/auth/AuthContext.js";
import getUser from "../../utils/getUser.js";
import { userCreatedListener } from "../../utils/echo/listeners/userCreatedListener";
import { userNotificationsListener } from "../../utils/echo/listeners/userNotificationsListener.js";
function Header() {
@@ -39,6 +43,7 @@ function Header() {
const activeChannels = [
userCreatedListener(echo, userData, setNotifications, setunreadNotification),
userNotificationsListener(echo, userData, setNotifications, setunreadNotification),
];
channelsToLeave = activeChannels.filter(name => name !== null);