mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 21:49:07 +02:00
Make weather display operational with correct API usage
Fixes 401 error for historical weather data by correcting the API URL syntax from `forecastBasisDate` to `/timeline/location/date`. Updates data formatting for temperature and conditions, ensures weather is visible to all users, and improves production logging for easier debugging. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d43bd811-9372-45a7-8ac9-4a954c0538e1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d43bd811-9372-45a7-8ac9-4a954c0538e1/xi5G4qi
This commit is contained in:
1 parent
62803e7b39
commit
d635bfb7c0
4 files changed
+40
-5
No files matched your search
+16
-1
@@ -2886,17 +2886,32 @@ RÉSUMÉ DU SCAN
|
||||
}
|
||||
}
|
||||
|
||||
res.json({
|
||||
// Toujours retourner une réponse même si seule l'année actuelle est disponible
|
||||
const response = {
|
||||
currentYear: currentYearData ? {
|
||||
...currentYearData,
|
||||
maxTemperature: parseFloat(currentYearData.tempMax),
|
||||
minTemperature: parseFloat(currentYearData.tempMin),
|
||||
condition: currentYearData.conditions,
|
||||
icon: weatherService.getWeatherIcon(currentYearData.icon)
|
||||
} : null,
|
||||
previousYear: previousYearData ? {
|
||||
...previousYearData,
|
||||
maxTemperature: parseFloat(previousYearData.tempMax),
|
||||
minTemperature: parseFloat(previousYearData.tempMin),
|
||||
condition: previousYearData.conditions,
|
||||
icon: weatherService.getWeatherIcon(previousYearData.icon)
|
||||
} : null,
|
||||
location: settings.location
|
||||
};
|
||||
|
||||
console.log('🌤️ [RESPONSE] Weather data prepared:', {
|
||||
hasCurrentYear: !!response.currentYear,
|
||||
hasPreviousYear: !!response.previousYear,
|
||||
location: response.location
|
||||
});
|
||||
|
||||
res.json(response);
|
||||
} catch (error) {
|
||||
console.error("Error fetching weather data:", error);
|
||||
res.status(500).json({ message: "Failed to fetch weather data" });
|
||||
|
||||
Reference in new issue
Block a user