fix(#560): check matchProfile in matchPage

pull/186/head
Andrei Dekterev 3 years ago
parent 9b8242a712
commit 786a11281b
  1. 7
      src/features/MatchPage/store/hooks/index.tsx

@ -175,7 +175,12 @@ export const useMatchPage = () => {
]) ])
useEffect(() => { useEffect(() => {
getMatchInfo(sportType, matchId).then(setMatchProfile) getMatchInfo(sportType, matchId).then(
(info) => (info?.sport
// проверяем именно какой-то ключ в объекте,
// потому что, когда матча не существует, приходит - []
? setMatchProfile(info) : window.location.replace(PAGES.home)),
)
}, [sportType, matchId]) }, [sportType, matchId])
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save