Commit 05de20be authored by Victor friboulet's avatar Victor friboulet
Browse files

ajout probabilité de pluie et choix jour dans fetchdata

parent 2fcd83f9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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}`);
@@ -42,6 +42,9 @@ class WeatherCard{
    Ville(){
        return this.city["name"];
    }
    probarain(){
        return this.forecast.probarain;
    }
    latitudeVille(){
        return this.city.latitude;
    }
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ function onSelectionneVille(){
    }

    const weatherCard = new WeatherCard(codeInsee);
    weatherCard.fetchData().then(() =>{
    weatherCard.fetchData(0).then(() =>{
        afficherMeteo(weatherCard);
    })
}