diff --git a/.gitignore b/.gitignore index 4d29575..2706b36 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ /.pnp .pnp.js +# env files +.env + # testing /coverage diff --git a/src/App.js b/src/App.js index 99bd8f3..d76f0d6 100644 --- a/src/App.js +++ b/src/App.js @@ -4,6 +4,8 @@ import { useState, useEffect } from 'react'; import Weather from './components/Weather'; import LoadingIndicator from './UI/LoadingIndicator'; +require('dotenv').config(); + import './app.css'; function App() { @@ -17,6 +19,8 @@ function App() { setSearch(e.target.value); } + const apiKey = process.env.REACT_APP_RAPIDAPI_KEY; + async function geoHandler() { setSearch(''); setIsLoading(true); @@ -32,7 +36,7 @@ function App() { const options = { method: 'GET', headers: { - 'X-RapidAPI-Key': '0173291af0msh62b3ca25953f210p13d732jsn66b4d9f97708', + 'X-RapidAPI-Key': apiKey, 'X-RapidAPI-Host': 'weatherapi-com.p.rapidapi.com', }, };