Skip to content

Commit

Permalink
Fetch weather data from 2 endpoints in parallel (#15)
Browse files Browse the repository at this point in the history
- [x] closes #14
- [x] Fix header box-sizing to avoid unneccessary scrollbar
  • Loading branch information
rajatkantinandi authored Nov 29, 2020
1 parent f3f8c3f commit 32094a2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weather-here",
"version": "1.3.0",
"version": "1.3.1",
"private": true,
"dependencies": {
"react": "^16.8.6",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"display": "fullscreen",
"Scope": "/",
"start_url": "/",
"version": "1.3.0",
"version": "1.3.1",
"icons": [
{
"src": "images/icons/icon-72x72.png",
Expand Down
1 change: 1 addition & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ body {
top: 0;
z-index: 2;
font-family: 'Lora', serif;
box-sizing: border-box;
}

.header h1 {
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/useFetchTemp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ const useFetchTemp = (unit) => {
};

const getCombinedTemps = async (location, fromLocalStorage) => {
let { temp, temp_max, temp_min, locationName, weather } = await fetchTemp(location, fromLocalStorage);
let { comingTemps, comingWeather } = await fetchComingTemp(location, fromLocalStorage);
let [{ temp, temp_max, temp_min, locationName, weather }, { comingTemps, comingWeather }] = await Promise.all([
fetchTemp(location, fromLocalStorage),
fetchComingTemp(location, fromLocalStorage),
]);

if (comingTemps) {
comingTemps[0][0] = Math.max(temp_max, comingTemps[0][0]);
Expand Down

1 comment on commit 32094a2

@vercel
Copy link

@vercel vercel bot commented on 32094a2 Nov 29, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.