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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user