Open
Conversation
| .then(response => response.json()) | ||
| .then(data => { | ||
| return { | ||
| Lat: data[0].lat, |
There was a problem hiding this comment.
if data comes in a different format your app will crash.
Always be safe, check if its array and if so, then try to access it. Also you need to catch the errors.
| .then(response => response.json()) | ||
| .then(data => { | ||
| return { | ||
| Lat: data[0].lat, |
|
|
||
| fetchCordinates(userInput) | ||
| .then(cordinates => { | ||
| getCurrWeather(cordinates); |
There was a problem hiding this comment.
you are calling this getCurrentWeather but this function returns nothing. Better calling it fetchWeather. Also you are displaying the weather inside of this function. This is confusing and prone to bugs. Be clear with what the functions are doing
| fetch(url, { method: 'GET' }) | ||
| .then(response => response.json()) | ||
| .then(data => { | ||
| let weatherData = { |
There was a problem hiding this comment.
if you are not reassigning this, should be const
| > | ||
| <h4><strong></strong></h4> | ||
| <div class="py-3 weather-info"> | ||
| <h3><strong></strong></h6> |
| > | ||
| <h4><strong></strong></h4> | ||
| <div class="py-3 weather-info"> | ||
| <h3><strong></strong></h6> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.