dynamic display of notifications
This commit is contained in:
@@ -2,23 +2,25 @@ import styles from "./Header.module.css"
|
||||
import { Link, NavLink } from "react-router";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import getUserNotifications from "../../utils/getUserNotifications.js";
|
||||
import getUser from "../../utils/getUser.js";
|
||||
|
||||
function Header() {
|
||||
const [notificationMenu, setnotificationMenu] = useState(false);
|
||||
const [unreadNotification, setunreadNotification] = useState(true);
|
||||
const [mobileMenu, setMobileMenu] = useState(false);
|
||||
const [notifications, setNotifications] = useState([{"content" : "ok"}, {"content" : "pourquoi pas antoine"}]);
|
||||
const [notifications, setNotifications] = useState([]);
|
||||
const notificationRef = useRef(null);
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
async function loadNotifications() {
|
||||
const notifData = await getUserNotifications();
|
||||
const user = await getUser();
|
||||
const notifData = await getUserNotifications(user.id);
|
||||
setNotifications(notifData || []);
|
||||
}
|
||||
|
||||
//loadNotifications();
|
||||
loadNotifications();
|
||||
const handleClickOutside = (event) => {
|
||||
if (
|
||||
notificationRef.current &&
|
||||
|
||||
Reference in New Issue
Block a user