From 72d57d0225e2a72a734ba38f8c6f87fbb6c04704 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Wed, 8 Jun 2022 18:59:05 +0700 Subject: [PATCH] fix(#2485): redirect to matchpage after payment --- src/features/BuyMatchPopup/store/hooks/index.tsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/features/BuyMatchPopup/store/hooks/index.tsx b/src/features/BuyMatchPopup/store/hooks/index.tsx index a1a65f27..7200bc9d 100644 --- a/src/features/BuyMatchPopup/store/hooks/index.tsx +++ b/src/features/BuyMatchPopup/store/hooks/index.tsx @@ -12,9 +12,7 @@ import last from 'lodash/last' import isEmpty from 'lodash/isEmpty' import size from 'lodash/size' -import { PAGES, ProfileTypes } from 'config' - -import { isMatchPage } from 'helpers/isMatchPage' +import { ProfileTypes } from 'config' import { buyMatchSubscription, @@ -30,7 +28,6 @@ import { Steps, SubscriptionType, } from 'features/BuyMatchPopup/types' -import { useAuthStore } from 'features/AuthStore' import { getProfileUrl } from 'features/ProfileLink/helpers' import { useSubscriptions } from './useSubscriptions' @@ -52,7 +49,6 @@ export const useBuyMatchPopup = () => { const [error, setError] = useState('') const [loader, setLoader] = useState(false) const [disabledBuyBtn, setDisabledBuyBtn] = useState(false) - const { user } = useAuthStore() const goTo = useCallback( (step: Steps, e?: MouseEvent) => setSteps((state) => { @@ -108,7 +104,6 @@ export const useBuyMatchPopup = () => { setError('') resetSubscriptions() setSelectedPackage(null) - if (isMatchPage() && user?.profile.country_code !== 'BR') history.push(PAGES.home) } const redirectToMatchProfile = ({ id, sportType }: Match) => { @@ -122,13 +117,9 @@ export const useBuyMatchPopup = () => { const onSuccessfulSubscription = () => goTo(Steps.Success) const postPaymentHandler = () => { - closePopup() if (!match) return - if (match.hasVideo || match.calc) { - redirectToMatchProfile(match) - } else { - window.location.reload() - } + redirectToMatchProfile(match) + closePopup() } const goToError = () => goTo(Steps.Error)