From c8760bfa493ad425fce9581ede3b06a19bdb0939 Mon Sep 17 00:00:00 2001 From: Ewan Zhang Date: Tue, 19 Mar 2024 13:08:21 +1300 Subject: [PATCH] update reademe and env --- .env | 1 + README.md | 11 ++++------- src/App.jsx | 4 +++- 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..d24e4f9 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_API_KEY=650ad8fb3c6e4ecab3190253232706 \ No newline at end of file diff --git a/README.md b/README.md index f768e33..a4113aa 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ -# React + Vite +# Weather App React + Vite ==> Azure -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh +- [Visit site here ](https://jolly-bush-09eb13f00.5.azurestaticapps.net/) +- [Weatherapi ](https://www.weatherapi.com/) +- [Documentation Followed](https://vitejs.dev/guide/static-deploy.html#azure-static-web-apps) diff --git a/src/App.jsx b/src/App.jsx index 531f379..8bfe166 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -14,7 +14,9 @@ function App() { useEffect(() => { //fetch the data from API endpoint fetch( - `https://api.weatherapi.com/v1/current.json?key=650ad8fb3c6e4ecab3190253232706&q=${currentCity}&aqi=no` + `https://api.weatherapi.com/v1/current.json?key=${ + import.meta.env.VITE_API_KEY + }&q=${currentCity}&aqi=no` ) .then((res) => res.json()) .then((result) => {