Update event in header
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
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"
|
||||
@@ -12,9 +8,13 @@ import readNotifications from "../../utils/notifications/readNotifications.js";
|
||||
import { userCreatedListener } from "../../utils/echo/listeners/userCreatedListener";
|
||||
import { userNotificationsListener } from "../../utils/echo/listeners/userNotificationsListener.js";
|
||||
import NotificationCard from "../NotificationCard/NotificationCard.jsx";
|
||||
import { EventContext } from "../../contexts/events/EventContext.js";
|
||||
import {AuthContext} from "../../contexts/auth/AuthContext.js";
|
||||
|
||||
function Header() {
|
||||
|
||||
const { update, user } = useContext(AuthContext);
|
||||
const { updateEvent } = useContext(EventContext);
|
||||
const [notificationMenu, setnotificationMenu] = useState(false);
|
||||
const [unreadNotification, setunreadNotification] = useState(false);
|
||||
const [mobileMenu, setMobileMenu] = useState(false);
|
||||
@@ -22,6 +22,9 @@ function Header() {
|
||||
const notificationRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
updateEvent();
|
||||
|
||||
let echoInstance = null;
|
||||
let channelsToLeave = [];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState, useContext } from "react";
|
||||
import { useState, useContext } from "react";
|
||||
import Event from "./components/Event/Event.jsx";
|
||||
import styles from "./EventsPage.module.css";
|
||||
import ToolBar from "../../components/ToolBar/ToolBar.jsx";
|
||||
@@ -8,13 +8,7 @@ import { EventContext } from "../../contexts/events/EventContext.js";
|
||||
|
||||
function EventsPage(){
|
||||
|
||||
const { updateEvent, events } = useContext(EventContext);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
updateEvent();
|
||||
}) ()
|
||||
}, []);
|
||||
const { events } = useContext(EventContext);
|
||||
|
||||
const [filters, setFilters] = useState({
|
||||
alphabetical: "asc",
|
||||
|
||||
Reference in New Issue
Block a user