From c58baf347021ba5215939e04f1d98856fce254aa Mon Sep 17 00:00:00 2001 From: canove Date: Thu, 24 Sep 2020 17:27:30 -0300 Subject: [PATCH] fix: notification not closing after click on ticket --- .../components/NotificationsPopOver/index.js | 18 +++++++++--------- frontend/src/hooks/useTickets/index.js | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/NotificationsPopOver/index.js b/frontend/src/components/NotificationsPopOver/index.js index 34917c1..c5e3977 100644 --- a/frontend/src/components/NotificationsPopOver/index.js +++ b/frontend/src/components/NotificationsPopOver/index.js @@ -82,7 +82,10 @@ const NotificationsPopOver = () => { }, [history, ticketId, userId]); const { tickets: openTickets } = useTickets({ status: "open" }); - const { tickets: pendingTickets } = useTickets({ status: "pending" }); + const { tickets: pendingTickets } = useTickets({ + status: "pending", + showAll: true, + }); useEffect(() => { if (openTickets.length > 0 || pendingTickets.length > 0) { @@ -136,9 +139,8 @@ const NotificationsPopOver = () => { setIsOpen(false); }, [setIsOpen]); - const handleSelectTicket = (e, ticket) => { - history.push(`/tickets/${ticket.id}`); - handleClickAway(); + const NotificationTicket = ({ children }) => { + return
{children}
; }; return ( @@ -175,11 +177,9 @@ const NotificationsPopOver = () => { ) : ( notifications.map(ticket => ( - + + + )) )} diff --git a/frontend/src/hooks/useTickets/index.js b/frontend/src/hooks/useTickets/index.js index 535f4ca..3c73da2 100644 --- a/frontend/src/hooks/useTickets/index.js +++ b/frontend/src/hooks/useTickets/index.js @@ -79,6 +79,7 @@ const useTickets = ({ searchParam, pageNumber, status, date, showAll }) => { useEffect(() => { setLoading(true); const delayDebounceFn = setTimeout(() => { + console.log(showAll); const fetchTickets = async () => { try { const { data } = await api.get("/tickets", {