diff --git a/src/features/JoinMatchPage/hooks.tsx b/src/features/JoinMatchPage/hooks.tsx index 1fdbded8..3980baad 100644 --- a/src/features/JoinMatchPage/hooks.tsx +++ b/src/features/JoinMatchPage/hooks.tsx @@ -29,6 +29,8 @@ export const useUnauthenticatedMatch = () => { useEffect(() => { getUnauthenticatedMatch(sportType, matchId).then(setMatchInfo) + + return () => setMatchInfo(null) }, [sportType, matchId]) return { diff --git a/src/features/Matches/helpers/getMatchClickAction/index.tsx b/src/features/Matches/helpers/getMatchClickAction/index.tsx index 57cd71ba..12f9e9b6 100644 --- a/src/features/Matches/helpers/getMatchClickAction/index.tsx +++ b/src/features/Matches/helpers/getMatchClickAction/index.tsx @@ -17,13 +17,16 @@ export const getMatchAccess = ({ storage, sub, }: Match) => { + const dateToMs = Date.parse(date?.replace(/ /, 'T')) // без замены не будет работать в сафари + const dateNowMin10 = dateToMs - 10 * 60 * 1000 + switch (true) { case !sub: return MatchAccess.CanBuyMatch case !access: return MatchAccess.NoCountryAccess // проверка времени матча - 10минут - case ((new Date(Date.parse(date.toString()) - 10 * 60 * 1000) < new Date()) && !live): + case ((new Date(dateNowMin10) < new Date()) && !live): return MatchAccess.RedirectToProfile case live: return MatchAccess.ViewMatchPopup