Skip to content

Commit 65fd28b

Browse files
committed
Merge integrations_page_revamp with fallback mechanism into PR 4607
2 parents 9bd6592 + e385f39 commit 65fd28b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/components/IntegrationGrid/IntegrationGrid.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,25 @@ function useCMSIntegrations() {
175175
setIntegrations(transformedData);
176176
setError(null);
177177
} catch (err) {
178-
console.error('Failed to fetch integrations from CMS:', err);
179-
setError(err instanceof Error ? err.message : 'Failed to fetch integrations');
180-
setIntegrations([]);
178+
console.error('Error loading integrations data from endpoint. Falling back to static JSON file.');
179+
180+
// Fallback to static JSON file
181+
try {
182+
const fallbackResponse = await fetch('/integrations-fallback.json');
183+
184+
if (!fallbackResponse.ok) {
185+
throw new Error(`Failed to load fallback data: ${fallbackResponse.status}`);
186+
}
187+
188+
const fallbackData = await fallbackResponse.json();
189+
const transformedData = transformCMSData(fallbackData.data || []);
190+
setIntegrations(transformedData);
191+
setError(null);
192+
} catch (fallbackErr) {
193+
console.error('Failed to load fallback integrations data:', fallbackErr);
194+
setError(fallbackErr instanceof Error ? fallbackErr.message : 'Failed to fetch integrations');
195+
setIntegrations([]);
196+
}
181197
} finally {
182198
setLoading(false);
183199
}

0 commit comments

Comments
 (0)