From af92f35e13bb42e8cabedb650a9e4f1a091cc4a9 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Tue, 24 Jan 2023 23:22:22 +0700 Subject: [PATCH] fix(#175): add params email to getMatchViewDuration funtion --- src/features/MatchPage/store/hooks/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/features/MatchPage/store/hooks/index.tsx b/src/features/MatchPage/store/hooks/index.tsx index ef1765ef..852e0566 100644 --- a/src/features/MatchPage/store/hooks/index.tsx +++ b/src/features/MatchPage/store/hooks/index.tsx @@ -75,10 +75,10 @@ export const useMatchPage = () => { matchPlaylists, }) - const getMatchViewDuration = () => (getViewMatchDuration({ + const getMatchViewDuration = (id: number) => (getViewMatchDuration({ matchId, sportType, - userId: Number(userInfo?.email), + userId: id, }).then(({ duration, error, @@ -106,18 +106,18 @@ export const useMatchPage = () => { matchId]) useEffect(() => { - if (user) return + if (user || !userInfo?.email) return const counter = setInterval( - () => getMatchViewDuration(), 1000 * 30, + () => getMatchViewDuration(Number(userInfo?.email)), 1000 * 30, ) // eslint-disable-next-line return () => clearInterval(counter) // eslint-disable-next-line react-hooks/exhaustive-deps }, [ - user, sportType, matchId, + userInfo, ]) useEffect(() => {