Fix: Reduce maintenance data request frequency.
Fix: The maintenance list should refresh immediately after a new maintenance entry is created.
This commit is contained in:
@@ -61,12 +61,14 @@ const getCompletedMaintenance = async (): Promise<MaintenanceItem[]> => {
|
||||
const createMaintenance = async (data: CreateMaintenanceInput): Promise<void> => {
|
||||
await createMaintenanceRecord(data);
|
||||
clearMaintenanceCache(); // Force cache refresh after creation
|
||||
console.log('Maintenance created and cache cleared');
|
||||
};
|
||||
|
||||
// Update an existing maintenance record
|
||||
const updateMaintenanceRecord = async (id: string, data: Partial<MaintenanceItem>): Promise<void> => {
|
||||
await updateMaintenance(id, data);
|
||||
clearMaintenanceCache(); // Force cache refresh after update
|
||||
console.log('Maintenance updated and cache cleared');
|
||||
};
|
||||
|
||||
// Refresh cache manually
|
||||
@@ -89,4 +91,4 @@ export const maintenanceService = {
|
||||
};
|
||||
|
||||
// Re-export types for convenience
|
||||
export type { MaintenanceItem, CreateMaintenanceInput };
|
||||
export type { MaintenanceItem, CreateMaintenanceInput };
|
||||
Reference in New Issue
Block a user