mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-21 22:18:17 +02:00
Merge pull request #154 from R0m1k3/1.1
Update weather data to show accurate local conditions
This commit is contained in:
3 files changed
+16
-1
No files matched your search
@@ -154,8 +154,9 @@ export default function WeatherWidget() {
|
|||||||
description: data.message,
|
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.invalidateQueries({ queryKey: ['/api/weather/current'] });
|
||||||
|
queryClient.refetchQueries({ queryKey: ['/api/weather/current'] });
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
onError: (error: any) => {
|
||||||
toast({
|
toast({
|
||||||
|
|||||||
@@ -2970,6 +2970,9 @@ RÉSUMÉ DU SCAN
|
|||||||
location: locationData.fullLocation
|
location: locationData.fullLocation
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Vider le cache météo car la localisation a changé
|
||||||
|
await storage.clearWeatherCache();
|
||||||
|
|
||||||
console.log('🌍 Localisation mise à jour automatiquement:', {
|
console.log('🌍 Localisation mise à jour automatiquement:', {
|
||||||
from: settings.location,
|
from: settings.location,
|
||||||
to: locationData.fullLocation,
|
to: locationData.fullLocation,
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ export interface IStorage {
|
|||||||
createWeatherData(data: InsertWeatherData): Promise<WeatherData>;
|
createWeatherData(data: InsertWeatherData): Promise<WeatherData>;
|
||||||
updateWeatherData(id: number, data: Partial<InsertWeatherData>): Promise<WeatherData>;
|
updateWeatherData(id: number, data: Partial<InsertWeatherData>): Promise<WeatherData>;
|
||||||
deleteOldWeatherData(daysToKeep: number): Promise<void>;
|
deleteOldWeatherData(daysToKeep: number): Promise<void>;
|
||||||
|
clearWeatherCache(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DatabaseStorage implements IStorage {
|
export class DatabaseStorage implements IStorage {
|
||||||
@@ -1840,6 +1841,11 @@ export class DatabaseStorage implements IStorage {
|
|||||||
|
|
||||||
console.log(`🧹 Deleted weather data older than ${daysToKeep} days`);
|
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
|
// MemStorage class for development
|
||||||
@@ -3261,6 +3267,11 @@ export class MemStorage implements IStorage {
|
|||||||
// In development, this is a no-op
|
// In development, this is a no-op
|
||||||
console.log(`🧹 DEV: Would delete weather data older than ${daysToKeep} days`);
|
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
|
// Use MemStorage in development, DatabaseStorage in production
|
||||||
|
|||||||
Reference in new issue
Block a user