Refactor API response handling across multiple components to ensure consistency with the unified format. Update error handling and response validation in ValidationCard, usePersistentToggle, Status, Prompts, and api.ts to improve user feedback and maintain compatibility with the new API standards.

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-16 00:19:01 +00:00
parent 5908115686
commit 7665b8c6e7
5 changed files with 140 additions and 87 deletions

View File

@@ -63,10 +63,10 @@ export default function Status() {
const fetchStatus = async () => {
try {
// fetchAPI extracts data from unified format {success: true, data: {...}}
// So response IS the data object
const response = await fetchAPI('/v1/system/status/');
// Handle unified API response format: {success: true, data: {...}}
const statusData = response?.data || response;
setStatus(statusData);
setStatus(response);
setError(null);
} catch (err) {
setError(err instanceof Error ? err.message : 'Unknown error');