From 9ea0b6852feb2eb2e3111580f4474ec218912427 Mon Sep 17 00:00:00 2001 From: Fadi Hanna Date: Mon, 16 Sep 2024 07:34:16 +0200 Subject: [PATCH] Remove unneeded ternary operators --- src/containers/App.tsx | 2 +- src/hooks/useAPI.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); })