|
|
|
|
@ -15,6 +15,8 @@ import { isMobileDevice } from 'config/userAgent' |
|
|
|
|
|
|
|
|
|
import { prepareMatches } from './helpers/prepareMatches' |
|
|
|
|
|
|
|
|
|
import { useAuthStore } from '../AuthStore' |
|
|
|
|
|
|
|
|
|
export type Match = ReturnType<typeof prepareMatches>[number] |
|
|
|
|
|
|
|
|
|
export type Props = { |
|
|
|
|
@ -33,6 +35,7 @@ const initialState = { |
|
|
|
|
|
|
|
|
|
export const useMatches = ({ fetch }: Props) => { |
|
|
|
|
const { userPreferences } = usePreferencesStore() |
|
|
|
|
const { user } = useAuthStore() |
|
|
|
|
const { |
|
|
|
|
isFetching, |
|
|
|
|
request: requestMatches, |
|
|
|
|
@ -81,10 +84,11 @@ export const useMatches = ({ fetch }: Props) => { |
|
|
|
|
}, [fetchMatches, userPreferences]) |
|
|
|
|
|
|
|
|
|
const preparedMatches = useMemo(() => ({ |
|
|
|
|
broadcast: prepareMatches(matches.broadcast), |
|
|
|
|
features: prepareMatches(matches.features), |
|
|
|
|
highlights: prepareMatches(matches.highlights), |
|
|
|
|
broadcast: prepareMatches(matches.broadcast, user), |
|
|
|
|
features: prepareMatches(matches.features, user), |
|
|
|
|
highlights: prepareMatches(matches.highlights, user), |
|
|
|
|
isVideoSections: matches.isVideoSections, |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}), [matches]) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|