feat(in-182): match videofix

keep-around/62417be7c1cc5ed942195c423c5f1f5f4254179d
Rita 3 years ago
parent da50a761ef
commit 65cdb73ec5
  1. 12
      src/features/MatchPage/store/hooks/useMatchPlaylists.tsx

@ -1,6 +1,7 @@
import { import {
useState, useState,
useCallback, useCallback,
useEffect,
} from 'react' } from 'react'
import isEmpty from 'lodash/isEmpty' import isEmpty from 'lodash/isEmpty'
@ -10,6 +11,8 @@ import type { SportTypes } from 'config/sportTypes'
import { MatchInfo } from 'requests/getMatchInfo' import { MatchInfo } from 'requests/getMatchInfo'
import { getMatchPlaylists } from 'requests/getMatchPlaylists' import { getMatchPlaylists } from 'requests/getMatchPlaylists'
import { usePageParams } from 'hooks/usePageParams'
import type { Playlists } from 'features/MatchPage/types' import type { Playlists } from 'features/MatchPage/types'
import { buildPlaylists } from 'features/MatchPage/helpers/buildPlaylists' import { buildPlaylists } from 'features/MatchPage/helpers/buildPlaylists'
@ -28,6 +31,7 @@ export const useMatchPlaylists = (profile: MatchInfo) => {
const [matchPlaylists, setMatchPlaylists] = useState<Playlists>(initialPlaylists) const [matchPlaylists, setMatchPlaylists] = useState<Playlists>(initialPlaylists)
const { fetchLexics } = usePlaylistLexics() const { fetchLexics } = usePlaylistLexics()
const { profileId } = usePageParams()
const { const {
handlePlaylistClick, handlePlaylistClick,
selectedPlaylist, selectedPlaylist,
@ -60,6 +64,14 @@ export const useMatchPlaylists = (profile: MatchInfo) => {
.then(setMatchPlaylists) .then(setMatchPlaylists)
}, [fetchLexics, setInitialSeletedPlaylist]) }, [fetchLexics, setInitialSeletedPlaylist])
useEffect(() => {
setSelectedPlaylist(matchPlaylists?.match[0])
}, [
matchPlaylists?.match,
profileId,
setSelectedPlaylist,
])
/** /**
* API не выдает длительность Полного матча * API не выдает длительность Полного матча
* Здесь получаем его из самого видео * Здесь получаем его из самого видео

Loading…
Cancel
Save