Make both Dark Sky API calls simultaneously
This commit is contained in:
@@ -26,8 +26,7 @@ export default class DarkSkyWeatherProvider extends WeatherProvider {
|
|||||||
|
|
||||||
let yesterdayData, todayData;
|
let yesterdayData, todayData;
|
||||||
try {
|
try {
|
||||||
yesterdayData = await httpJSONRequest( yesterdayUrl );
|
[ yesterdayData, todayData ] = await Promise.all( [ httpJSONRequest( yesterdayUrl ), httpJSONRequest( todayUrl ) ] );
|
||||||
todayData = await httpJSONRequest( todayUrl );
|
|
||||||
} catch ( err ) {
|
} catch ( err ) {
|
||||||
console.error( "Error retrieving weather information from Dark Sky:", err );
|
console.error( "Error retrieving weather information from Dark Sky:", err );
|
||||||
throw "An error occurred while retrieving weather information from Dark Sky."
|
throw "An error occurred while retrieving weather information from Dark Sky."
|
||||||
|
|||||||
Reference in New Issue
Block a user