From a5434f918dccb5f350971afbd45b3064122201f1 Mon Sep 17 00:00:00 2001 From: Simeon Widdis Date: Mon, 5 Feb 2024 22:21:06 -0800 Subject: [PATCH] Add redirect with error message if integrations template not found (#1412) Signed-off-by: Simeon Widdis --- .../components/integrations/components/integration.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/components/integrations/components/integration.tsx b/public/components/integrations/components/integration.tsx index c005e98d0..e94fd7e94 100644 --- a/public/components/integrations/components/integration.tsx +++ b/public/components/integrations/components/integration.tsx @@ -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); }); } @@ -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]); @@ -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]);