Loading js/WeatherCard.js +5 −2 Original line number Diff line number Diff line Loading @@ -10,11 +10,11 @@ class WeatherCard{ this.forecast = null; } async fetchData() { async fetchData(jour) { try { // Utilisez "await" pour attendre la réponse de la requête const response = await fetch( `https://api.meteo-concept.com/api/forecast/daily/0?token=${Token}&insee=${this.CodeInsee}` `https://api.meteo-concept.com/api/forecast/daily/${jour}'?token=${Token}&insee=${this.CodeInsee}` ); if (!response.ok) { throw new Error(`Erreur de requête: ${response.status}`); Loading Loading @@ -42,6 +42,9 @@ class WeatherCard{ Ville(){ return this.city["name"]; } probarain(){ return this.forecast.probarain; } latitudeVille(){ return this.city.latitude; } Loading js/interface.js +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ function onSelectionneVille(){ } const weatherCard = new WeatherCard(codeInsee); weatherCard.fetchData().then(() =>{ weatherCard.fetchData(0).then(() =>{ afficherMeteo(weatherCard); }) } Loading Loading
js/WeatherCard.js +5 −2 Original line number Diff line number Diff line Loading @@ -10,11 +10,11 @@ class WeatherCard{ this.forecast = null; } async fetchData() { async fetchData(jour) { try { // Utilisez "await" pour attendre la réponse de la requête const response = await fetch( `https://api.meteo-concept.com/api/forecast/daily/0?token=${Token}&insee=${this.CodeInsee}` `https://api.meteo-concept.com/api/forecast/daily/${jour}'?token=${Token}&insee=${this.CodeInsee}` ); if (!response.ok) { throw new Error(`Erreur de requête: ${response.status}`); Loading Loading @@ -42,6 +42,9 @@ class WeatherCard{ Ville(){ return this.city["name"]; } probarain(){ return this.forecast.probarain; } latitudeVille(){ return this.city.latitude; } Loading
js/interface.js +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ function onSelectionneVille(){ } const weatherCard = new WeatherCard(codeInsee); weatherCard.fetchData().then(() =>{ weatherCard.fetchData(0).then(() =>{ afficherMeteo(weatherCard); }) } Loading