|
|
|
@ -2,6 +2,7 @@ import { useEffect, useState } from 'react' |
|
|
|
|
|
|
|
|
|
|
|
import isNull from 'lodash/isNull' |
|
|
|
import isNull from 'lodash/isNull' |
|
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
|
|
|
|
|
import filter from 'lodash/filter' |
|
|
|
|
|
|
|
|
|
|
|
import type { LiveVideos, Videos } from 'requests' |
|
|
|
import type { LiveVideos, Videos } from 'requests' |
|
|
|
import { getLiveVideos, getVideos } from 'requests' |
|
|
|
import { getLiveVideos, getVideos } from 'requests' |
|
|
|
@ -21,7 +22,8 @@ export const useVideoData = () => { |
|
|
|
const live = await getLiveVideos(sportType, matchId) |
|
|
|
const live = await getLiveVideos(sportType, matchId) |
|
|
|
if (isNull(live) || isEmpty(live)) { |
|
|
|
if (isNull(live) || isEmpty(live)) { |
|
|
|
const videosResponse = await getVideos(sportType, matchId) |
|
|
|
const videosResponse = await getVideos(sportType, matchId) |
|
|
|
setVideos(videosResponse) |
|
|
|
const filteredVideosResponseByAbc = filter(videosResponse, (vid) => vid.abc !== 1) |
|
|
|
|
|
|
|
setVideos(filteredVideosResponseByAbc) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setLiveVideos(live) |
|
|
|
setLiveVideos(live) |
|
|
|
} |
|
|
|
} |
|
|
|
|