summaryrefslogtreecommitdiff
path: root/src/lib/video/hooks/useVideo.js
blob: 6086f9aa935d6061cea7c243cb256a756e0f90fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { useQuery } from 'react-query'
import videoApi from '../api/videoApi'

const useVideo = ({ limit, offset }) => {
  const fetchVideo = async () => await videoApi({ limit, offset })
  const video = useQuery(`video-${limit}-${offset}`, fetchVideo, {
    refetchOnWindowFocus: false
  })

  return { video }
}

export default useVideo