diff --git a/src/features/BuyMatchPopup/components/PackageSelectionStep/index.tsx b/src/features/BuyMatchPopup/components/PackageSelectionStep/index.tsx index 3664b63d..e1994140 100644 --- a/src/features/BuyMatchPopup/components/PackageSelectionStep/index.tsx +++ b/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(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) => { cards?.length