Merge pull request #154 from R0m1k3/1.1

Update weather data to show accurate local conditions
This commit is contained in:
LogiFlow authored and GitHub committed 2025-08-15 13:44:14 +02:00
commit 286a30f2ba
3 files changed
+16 -1

No files matched your search

+2 -1
View File
@@ -154,8 +154,9 @@ export default function WeatherWidget() {
description: data.message,
});
// Actualiser les données météo
// Forcer le rechargement immédiat des données météo
queryClient.invalidateQueries({ queryKey: ['/api/weather/current'] });
queryClient.refetchQueries({ queryKey: ['/api/weather/current'] });
},
onError: (error: any) => {
toast({
+3
View File
@@ -2970,6 +2970,9 @@ RÉSUMÉ DU SCAN
location: locationData.fullLocation
});
// Vider le cache météo car la localisation a changé
await storage.clearWeatherCache();
console.log('🌍 Localisation mise à jour automatiquement:', {
from: settings.location,
to: locationData.fullLocation,
+11
View File
@@ -202,6 +202,7 @@ export interface IStorage {
createWeatherData(data: InsertWeatherData): Promise<WeatherData>;
updateWeatherData(id: number, data: Partial<InsertWeatherData>): Promise<WeatherData>;
deleteOldWeatherData(daysToKeep: number): Promise<void>;
clearWeatherCache(): Promise<void>;
}
export class DatabaseStorage implements IStorage {
@@ -1840,6 +1841,11 @@ export class DatabaseStorage implements IStorage {
console.log(`🧹 Deleted weather data older than ${daysToKeep} days`);
}
async clearWeatherCache(): Promise<void> {
await db.delete(weatherData);
console.log('🧹 Weather cache cleared due to location change');
}
}
// MemStorage class for development
@@ -3261,6 +3267,11 @@ export class MemStorage implements IStorage {
// In development, this is a no-op
console.log(`🧹 DEV: Would delete weather data older than ${daysToKeep} days`);
}
async clearWeatherCache(): Promise<void> {
// In development, this is a no-op
console.log('🧹 DEV: Weather cache cleared due to location change');
}
}
// Use MemStorage in development, DatabaseStorage in production