Skip to content

Eval submission#82

Open
etiry wants to merge 23 commits intoprojectshft:masterfrom
etiry:master
Open

Eval submission#82
etiry wants to merge 23 commits intoprojectshft:masterfrom
etiry:master

Conversation

@etiry
Copy link

@etiry etiry commented Aug 25, 2023

No description provided.


export const FETCH_LOCATION = 'FETCH_LOCATION';

const API_KEY = process.env.REACT_APP_API_KEY;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a .env file at your root for this to work correctly

const API_KEY = process.env.REACT_APP_API_KEY;
const ROOT_URL = 'https://api.openweathermap.org';

export function fetchLocation(query) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would recommend using function expressions over declarations


const fetchForecast = (lat, lon) =>
axios.get(
`${ROOT_URL}/data/2.5/forecast?lat=${lat}&lon=${lon}&units=imperial&appid=${API_KEY}`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since both of these functions are doing the same kind of call, would be better to make a generic fetch function and send in all the rest of the needed data as parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants