fix(#175): add params email to getMatchViewDuration funtion

pull/44/head
Andrei Dekterev 3 years ago committed by Gitea
parent 2bd97402f4
commit af92f35e13
  1. 10
      src/features/MatchPage/store/hooks/index.tsx

@ -75,10 +75,10 @@ export const useMatchPage = () => {
matchPlaylists, matchPlaylists,
}) })
const getMatchViewDuration = () => (getViewMatchDuration({ const getMatchViewDuration = (id: number) => (getViewMatchDuration({
matchId, matchId,
sportType, sportType,
userId: Number(userInfo?.email), userId: id,
}).then(({ }).then(({
duration, duration,
error, error,
@ -106,18 +106,18 @@ export const useMatchPage = () => {
matchId]) matchId])
useEffect(() => { useEffect(() => {
if (user) return if (user || !userInfo?.email) return
const counter = setInterval( const counter = setInterval(
() => getMatchViewDuration(), 1000 * 30, () => getMatchViewDuration(Number(userInfo?.email)), 1000 * 30,
) )
// eslint-disable-next-line // eslint-disable-next-line
return () => clearInterval(counter) return () => clearInterval(counter)
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [
user,
sportType, sportType,
matchId, matchId,
userInfo,
]) ])
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save