fix(#2480): disabled buy button after click

keep-around/423dc333a2396afd7463c655dca312d026b396be
Andrei Dekterev 4 years ago
parent 96431f749f
commit 423dc333a2
  1. 2
      Makefile
  2. 5
      src/features/BuyMatchPopup/components/PackageSelectionStep/index.tsx
  3. 3
      src/features/BuyMatchPopup/store/hooks/index.tsx

@ -172,7 +172,7 @@ a-stage: build-a
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@10.0.3.8:/usr/local/www/ott-staging/a-wwwroot/ rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@10.0.3.8:/usr/local/www/ott-staging/a-wwwroot/
b-stage: build-b b-stage: build-b
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@staging.instat.tv:/usr/local/www/ott-staging/b-wwwroot/ rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@10.0.3.8:/usr/local/www/ott-staging/b-wwwroot/
c-stage: build-c c-stage: build-c
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@10.0.3.8:/usr/local/www/ott-staging/c-wwwroot/ rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@10.0.3.8:/usr/local/www/ott-staging/c-wwwroot/

@ -39,6 +39,7 @@ export const PackageSelectionStep = () => {
const { const {
close, close,
disabledBuyBtn,
goBack, goBack,
hasPreviousStep, hasPreviousStep,
loader, loader,
@ -46,6 +47,7 @@ export const PackageSelectionStep = () => {
onBuyClick, onBuyClick,
selectedPackage, selectedPackage,
selectedSubscription, selectedSubscription,
setDisabledBuyBtn,
} = useBuyMatchPopupStore() } = useBuyMatchPopupStore()
useEffect(() => { useEffect(() => {
@ -59,6 +61,7 @@ export const PackageSelectionStep = () => {
const isBrasil = user?.profile.country_code === 'BR' const isBrasil = user?.profile.country_code === 'BR'
const onHandleClick = (e?: MouseEvent<HTMLButtonElement>) => { const onHandleClick = (e?: MouseEvent<HTMLButtonElement>) => {
setDisabledBuyBtn(true)
if (isBrasil) { if (isBrasil) {
setIsOpenBrasilian(true) setIsOpenBrasilian(true)
} else { } else {
@ -100,7 +103,7 @@ export const PackageSelectionStep = () => {
<ArrowLoader width='204px' disabled /> <ArrowLoader width='204px' disabled />
) : ( ) : (
<Button <Button
disabled={!selectedPackage} disabled={!selectedPackage || disabledBuyBtn}
onClick={onHandleClick} onClick={onHandleClick}
> >
<T9n t='buy_subscription' /> <T9n t='buy_subscription' />

@ -51,6 +51,7 @@ export const useBuyMatchPopup = () => {
const [match, setMatch] = useState<Match | null>(null) const [match, setMatch] = useState<Match | null>(null)
const [error, setError] = useState('') const [error, setError] = useState('')
const [loader, setLoader] = useState(false) const [loader, setLoader] = useState(false)
const [disabledBuyBtn, setDisabledBuyBtn] = useState(false)
const { user } = useAuthStore() const { user } = useAuthStore()
const goTo = useCallback( const goTo = useCallback(
@ -188,6 +189,7 @@ export const useBuyMatchPopup = () => {
return { return {
close: closePopup, close: closePopup,
currentStep: last(steps), currentStep: last(steps),
disabledBuyBtn,
error, error,
goBack, goBack,
goTo, goTo,
@ -205,6 +207,7 @@ export const useBuyMatchPopup = () => {
selectedPackage, selectedPackage,
selectedPeriod, selectedPeriod,
selectedSubscription, selectedSubscription,
setDisabledBuyBtn,
subscriptions, subscriptions,
} }
} }

Loading…
Cancel
Save