diff --git a/src/containers/App.tsx b/src/containers/App.tsx index 5f8f630..b2b46c8 100644 --- a/src/containers/App.tsx +++ b/src/containers/App.tsx @@ -20,7 +20,7 @@ const App = () => { const { dispatch, searchForm } = useReduxConsts(); const imagesEndPoint: string = `?key=${PixabayKey}&q=${searchForm.query}`; - const videosEndPoint: string = `videos/?key=${PixabayKey}&q=${searchForm.query && searchForm.query}`; + const videosEndPoint: string = `videos/?key=${PixabayKey}&q=${searchForm.query}`; const { data: imgData } = useAPI(imagesEndPoint, 'get', searchForm); const { data: videoData } = useAPI(videosEndPoint, 'get', searchForm); diff --git a/src/hooks/useAPI.ts b/src/hooks/useAPI.ts index 8bee66d..f5e3611 100644 --- a/src/hooks/useAPI.ts +++ b/src/hooks/useAPI.ts @@ -15,7 +15,7 @@ const useAPI = ( const getData = async () => { setLoading(true); - axios[method](endPoint, headers && headers, JSON.parse(body ? body : null)) + axios[method](endPoint, headers, JSON.parse(body ? body : null)) .then((res) => { setData(res.data); })