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