From e494b9b0d91a3e1b2f0bda699bf0f240c196f5fc Mon Sep 17 00:00:00 2001 From: Harsh kumar <85338625+Harsh09889@users.noreply.github.com> Date: Wed, 11 Oct 2023 22:39:35 +0530 Subject: [PATCH] API key added to the env.local and null check in movieslist applied --- .env.local | 1 + src/App.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .env.local diff --git a/.env.local b/.env.local new file mode 100644 index 0000000..166332a --- /dev/null +++ b/.env.local @@ -0,0 +1 @@ +REACT_APP_IMDB_KEY=449ca763 \ No newline at end of file diff --git a/src/App.js b/src/App.js index 0204315..9884b16 100644 --- a/src/App.js +++ b/src/App.js @@ -11,7 +11,7 @@ function App() { const [searchValue, setSearchValue] = useState(""); const getMovieRequest = async (searchValue) => { - const url = `http://www.omdbapi.com/?s=${searchValue}&apikey=449ca763`; + const url = `http://www.omdbapi.com/?s=${searchValue}&apikey=${process.env.REACT_APP_IMDB_KEY}`; const response = await fetch(url); const responseJson = await response.json(); @@ -65,7 +65,7 @@ function App() { />