Conversation
app/page.js
Outdated
| useSelector((state) => state.weather); | ||
|
|
||
| const handleSearch = () => { | ||
| console.log(searchInput); |
There was a problem hiding this comment.
Remember to clean up console.log in code - should only be used for troubleshooting.
There was a problem hiding this comment.
UgH! I get so excited about submitting the evals because I'm so sick of looking at my wonky apps...
app/page.js
Outdated
|
|
||
| const handleSearch = () => { | ||
| console.log(searchInput); | ||
| if (searchInput.trim() !=='') { |
There was a problem hiding this comment.
nitpick: spacing
if (searchInput.trim() !== '') {
| export const fetchWeather = createAsyncThunk( | ||
| 'weather/fetchWeatherData', | ||
| async (city, thunkAPI) => { | ||
| try { |
| 'weather/fetchWeatherData', | ||
| async (city, thunkAPI) => { | ||
| try { | ||
| const response = await axios.get(`https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=1a8c344b0aaddd77f2a53a70916ddc5b&units=imperial`); |
There was a problem hiding this comment.
recommend separating out appid as a variable
There was a problem hiding this comment.
I don't understand this?!?
like this
const appID = '1a8c344b0aaddd77f2a53a70916ddc5b';
&appid=${appID}
|
I made some edits based on Laura's comments. Should be slightly better than last version. |
|
Rony/Laura. Hopefully I am submitting the correct version this time. Pretty sure I executed the git commit/push correctly this time. Thank you as always. |
| </a> | ||
| dispatch(fetchWeather(searchInput)) | ||
| .then((response) => { | ||
| if (response.payload.cod === '404') { |
There was a problem hiding this comment.
interesting that the interface is .cod and not .code
| </ul> | ||
| <ul> | ||
| <li className='data'>5-day average: {calculateAverage(result.data.list, 'humidity')}</li> | ||
| </ul> |
There was a problem hiding this comment.
this html is a bit long and hard to understand, there's logic also that could have been extracted to functions to help with readability
| 'weather/fetchWeatherData', | ||
| async (city, thunkAPI) => { | ||
| try { | ||
| const response = await axios.get(`https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=1a8c344b0aaddd77f2a53a70916ddc5b&units=imperial`); |
So ugly, but it works...