diff --git a/AppImage/components/health-status-modal.tsx b/AppImage/components/health-status-modal.tsx index 0f4a034..7a09397 100644 --- a/AppImage/components/health-status-modal.tsx +++ b/AppImage/components/health-status-modal.tsx @@ -179,6 +179,8 @@ export function HealthStatusModal({ open, onOpenChange, getApiUrl }: HealthStatu const handleAcknowledge = async (errorKey: string, e: React.MouseEvent) => { e.stopPropagation() // Prevent navigation + console.log("[v0] Dismissing error:", errorKey) + try { const response = await fetch(getApiUrl("/api/health/acknowledge"), { method: "POST", @@ -189,13 +191,19 @@ export function HealthStatusModal({ open, onOpenChange, getApiUrl }: HealthStatu }) if (!response.ok) { - throw new Error("Failed to acknowledge error") + const errorData = await response.json() + console.error("[v0] Acknowledge failed:", errorData) + throw new Error(errorData.error || "Failed to acknowledge error") } + const result = await response.json() + console.log("[v0] Acknowledge success:", result) + // Refresh health data await fetchHealthDetails() } catch (err) { console.error("[v0] Error acknowledging:", err) + alert("Failed to dismiss error. Please try again.") } } diff --git a/AppImage/scripts/flask_health_routes.py b/AppImage/scripts/flask_health_routes.py index 22534c0..31e4150 100644 --- a/AppImage/scripts/flask_health_routes.py +++ b/AppImage/scripts/flask_health_routes.py @@ -49,10 +49,15 @@ def get_system_info(): except Exception as e: return jsonify({'error': str(e)}), 500 -@health_bp.route('/api/health/acknowledge/', methods=['POST']) -def acknowledge_error(error_key): +@health_bp.route('/api/health/acknowledge', methods=['POST']) +def acknowledge_error(): """Acknowledge an error manually (user dismissed it)""" try: + data = request.get_json() + if not data or 'error_key' not in data: + return jsonify({'error': 'error_key is required'}), 400 + + error_key = data['error_key'] health_persistence.acknowledge_error(error_key) return jsonify({'success': True, 'message': 'Error acknowledged'}) except Exception as e: