Skip to content

Commit

Permalink
Add redirect with error message if integrations template not found (#…
Browse files Browse the repository at this point in the history
…1412)

Signed-off-by: Simeon Widdis <[email protected]>
(cherry picked from commit a5434f9)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Feb 6, 2024
1 parent 7442e6f commit 6be0e5a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions public/components/integrations/components/integration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export function Integration(props: AvailableIntegrationProps) {
async function handleDataRequest() {
// TODO fill in ID request here
http.get(`${INTEGRATIONS_BASE}/repository/${integrationTemplateId}`).then((exists) => {
if (!exists.data) {
window.location.hash = '#/available';
setToast(`Template '${integrationTemplateId}' not found`, 'danger');
return;
}
setIntegration(exists.data);
});
}
Expand All @@ -70,7 +75,7 @@ export function Integration(props: AvailableIntegrationProps) {
return parsedResponse.data.mappings[integration.type];
})
.then((mapping) => setMapping(mapping))
.catch((err: any) => {
.catch((err) => {
console.error(err.message);
});
}, [integration]);
Expand All @@ -88,7 +93,7 @@ export function Integration(props: AvailableIntegrationProps) {
return parsedResponse.data;
})
.then((assets) => setAssets(assets))
.catch((err: any) => {
.catch((err) => {
console.error(err.message);
});
}, [integration]);
Expand Down

0 comments on commit 6be0e5a

Please sign in to comment.