Add health check endpoint and refactor integration response handling
- Introduced a new public health check endpoint at `api/ping/` to verify API responsiveness. - Refactored integration response handling to utilize a unified success and error response format across various methods in `IntegrationSettingsViewSet`, improving consistency and clarity in API responses. - Updated URL patterns to include the new ping endpoint and adjusted imports accordingly.
This commit is contained in:
@@ -138,6 +138,8 @@ export default function ImageGenerationCard({
|
||||
console.log('[ImageGenerationCard] Making request to image generation endpoint');
|
||||
console.log('[ImageGenerationCard] Request body:', requestBody);
|
||||
|
||||
// fetchAPI extracts data from unified format {success: true, data: {...}}
|
||||
// So data is the extracted response payload
|
||||
const data = await fetchAPI('/v1/system/settings/integrations/image_generation/generate/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(requestBody),
|
||||
@@ -145,8 +147,10 @@ export default function ImageGenerationCard({
|
||||
|
||||
console.log('[ImageGenerationCard] Response data:', data);
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || 'Failed to generate image');
|
||||
// fetchAPI extracts data from unified format, so data is the response payload
|
||||
// If fetchAPI didn't throw, the request was successful
|
||||
if (!data || typeof data !== 'object') {
|
||||
throw new Error('Invalid response format');
|
||||
}
|
||||
|
||||
const imageData = {
|
||||
|
||||
Reference in New Issue
Block a user