diff --git a/src/features/BuyMatchPopup/components/PackagesList/index.tsx b/src/features/BuyMatchPopup/components/PackagesList/index.tsx index bef24119..a92415c2 100644 --- a/src/features/BuyMatchPopup/components/PackagesList/index.tsx +++ b/src/features/BuyMatchPopup/components/PackagesList/index.tsx @@ -67,13 +67,13 @@ export const PackagesList = ({ /> { subPackage.type === SubscriptionType.Month - && ( - - - - ) + && ( + + + + ) } diff --git a/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx b/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx index 40ba62df..ba19cc19 100644 --- a/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx +++ b/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx @@ -17,6 +17,8 @@ import { Wrapper, } from 'features/BuyMatchPopup/styled' +import { checkUrlParams, getAllUrlParams } from 'helpers/parseUrlParams/parseUrlParams' + import { MatchPackage, SubscriptionType } from '../../types' import { @@ -32,7 +34,6 @@ import { ChooseSubItem, ChooseSubList, } from './styled' -import { checkUrlParams, getAllUrlParams } from '../../../../helpers/parseUrlParams/parseUrlParams' export const SelectSubscriptionStep = () => { const { diff --git a/src/features/BuyMatchPopup/store/hooks/index.tsx b/src/features/BuyMatchPopup/store/hooks/index.tsx index e1625fb5..328ab4de 100644 --- a/src/features/BuyMatchPopup/store/hooks/index.tsx +++ b/src/features/BuyMatchPopup/store/hooks/index.tsx @@ -89,7 +89,7 @@ export const useBuyMatchPopup = () => { const onNext = (e: MouseEvent) => goTo(Steps.SelectPackage, e) - const openPopup = useCallback((matchData: Match) => { + const openPopup = useCallback((matchData: Match | null) => { setMatch(matchData) setSteps([]) }, []) diff --git a/src/features/BuyMatchPopup/store/hooks/useSubscriptions.tsx b/src/features/BuyMatchPopup/store/hooks/useSubscriptions.tsx index 7e9710d1..abff9ea6 100644 --- a/src/features/BuyMatchPopup/store/hooks/useSubscriptions.tsx +++ b/src/features/BuyMatchPopup/store/hooks/useSubscriptions.tsx @@ -10,6 +10,7 @@ import first from 'lodash/first' import size from 'lodash/size' import { getSubscriptions } from 'requests/getSubscriptions' +import { getSelectedSubscriptions } from 'requests/getSelectedSubscriptions' import { useLexicsStore } from 'features/LexicsStore' @@ -63,7 +64,14 @@ export const useSubscriptions = () => { const fetchSubscriptions = useCallback(async (match: Match) => { let subscriptions if (checkUrlParams('id') && checkUrlParams('subscribe')) { - subscriptions = await getSubscriptions(MATCH_CONFIG.sportId, MATCH_CONFIG.matchId) + const subs = await getSelectedSubscriptions() + subscriptions = { + data: subs, + season: { + id: 0, + name: `${new Date().getFullYear()}`, + }, + } } else { subscriptions = await getSubscriptions(match.sportType, match.id) } diff --git a/src/features/TournamentPage/hooks.tsx b/src/features/TournamentPage/hooks.tsx index bc2ec773..f74ae4c5 100644 --- a/src/features/TournamentPage/hooks.tsx +++ b/src/features/TournamentPage/hooks.tsx @@ -18,13 +18,12 @@ import { checkUrlParams, getAllUrlParams } from 'helpers/parseUrlParams/parseUrl import { usePageParams } from 'hooks/usePageParams' import { useName } from 'features/Name' -import { useAuthStore } from 'features/AuthStore' - import { isPermittedTournament } from '../../helpers/isPermittedTournament' import { useProfileCard } from '../ProfileCard/hooks' import { useBuyMatchPopupStore } from '../BuyMatchPopup' import { MATCH_CONFIG } from '../BuyMatchPopup/store/hooks/useSubscriptions' import { prepareMatchProfile } from '../MatchPage/helpers/prepareMatchProfile' +import { useAuthStore } from '../AuthStore' export const useTournamentPage = () => { const [tournamentProfile, setTournamentProfile] = useState(null) @@ -32,6 +31,7 @@ export const useTournamentPage = () => { const { open: openBuyMatchPopup } = useBuyMatchPopupStore() const country = useName(tournamentProfile?.country || {}) const history = useHistory() + const { user } = useAuthStore() const { isFavorite, toggleFavorites } = useProfileCard() @@ -77,7 +77,7 @@ export const useTournamentPage = () => { useEffect(() => { if ((checkUrlParams('subscribe') - && getAllUrlParams('id'))) { + && getAllUrlParams('id'))) { getMatchInfo(MATCH_CONFIG.sportId, MATCH_CONFIG.matchId) .then((match: MatchInfo) => { const matchProfile = match && prepareMatchProfile({