fix(#2652): add check brasilian user from backend

keep-around/31934c87741a585cc6b3c9552489ffa62de670b6
Andrei Dekterev 3 years ago
parent 64237b3655
commit 1bc99252ac
  1. 12
      src/features/BuyMatchPopup/components/PackageSelectionStep/index.tsx

@ -9,7 +9,8 @@ import isNull from 'lodash/isNull'
import { MDASH } from 'config'
import { useAuthStore } from 'features/AuthStore'
import { CountryCodeType, getCountryCode } from 'requests/getCountryCode'
import { CloseButton, HeaderActions } from 'features/PopupComponents'
import { T9n } from 'features/T9n'
import { Name } from 'features/Name'
@ -38,7 +39,7 @@ export const PackageSelectionStep = () => {
fetchCards,
} = useCardsStore()
const [isOpenBrasilian, setIsOpenBrasilian] = useState(false)
const { user } = useAuthStore()
const [countryCode, setCountryCode] = useState<CountryCodeType | null>(null)
const {
close,
@ -56,6 +57,7 @@ export const PackageSelectionStep = () => {
} = useBuyMatchPopupStore()
useEffect(() => {
getUserCountry()
if (isNull(cards)) {
fetchCards()
}
@ -63,7 +65,11 @@ export const PackageSelectionStep = () => {
if (!match) return null
const isBrasil = user?.profile.country_code === 'BR'
const isBrasil = countryCode?.country_code === 'BR'
const getUserCountry = () => {
getCountryCode().then(setCountryCode)
}
const onHandleClick = (e?: MouseEvent<HTMLButtonElement>) => {
cards?.length

Loading…
Cancel
Save