Skip to content

Commit

Permalink
Fixing Country Dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
allaaamr committed Dec 24, 2021
1 parent ccc1ad7 commit c393c29
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 6 deletions.
169 changes: 168 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/src/Components/User/MyReservations.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const MyReservations = () =>{
<div id={`return${index}`}>
<BoardingPass id={`return${index}`} Booking={Return.Booking} Flight={Return.Flight} />
</div>
<Weather />
<Weather City={Departure.Flight.ArrivalAirport} />
<Divider style= {{backgroundColor: 'black'}}/>

</>
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/Components/User/Weather/Weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import axios from "axios";
import Sunny from './Sunny'
require("dotenv").config()

const Weather = () =>{
const Weather = ({City}) =>{

const [weather, setWeather] = useState("");
const [weather2, setWeather2] = useState("");
const base_url = "https://api.openweathermap.org/data/2.5/forecast?q="
const city_name = "Cairo"

const api_key = "68d40f12553da0869dd6c2629436f43f"
const complete_url = base_url + city_name + "&appid=" + api_key + "&cnt=4"
const complete_url = base_url + City + "&appid=" + api_key + "&cnt=4"


useEffect(() => {
const getWeather = async () => {
const {data} = await axios.get(`${complete_url}`);
setWeather(data);


};
getWeather();
Expand All @@ -26,7 +27,10 @@ const Weather = () =>{

if(weather)
return(
<>
<Sunny weather={weather} />

</>
)
else
return <> </>
Expand Down

0 comments on commit c393c29

Please sign in to comment.