export const userCreatedListener = (echo, userData, setNotifications, setunreadNotification, updatePendingMembers) => {
    if (userData.isAdmin) {
        const channelName = "users.registration";
        echo.private(channelName)
            .listen(".users.registration", (event) => {
                const newNotification = {
                    id: Date.now(),
                    content: `Nouvelle demande d'inscription : ${event.user.name} ${event.user.lastname}`,
                    created_at: Date.now(),
                    pivot: { unread: 1 }
                };
                setNotifications(prev => [newNotification, ...prev]);
                setunreadNotification(true);
                updatePendingMembers();
            });
        return channelName;
    }
    return null;
};