Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
alert for all updates to integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kahboom committed Jan 13, 2022
1 parent 5219483 commit 7dfba79
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/pages/Dashboard.tsx
Expand Up @@ -109,8 +109,6 @@ const Dashboard = () => {
}, [previousYaml, yamlData]);

const updateIntegration = async (newSteps: any) => {
//console.table(newSteps);

try {
setIsLoading(true);

Expand All @@ -121,10 +119,23 @@ const Dashboard = () => {
});

const data = await resp.text();

addAlert &&
addAlert({
title: 'Integration updated successfully',
variant: AlertVariant.success,
});

setYamlData(data);
setIsError(false);
} catch (err) {
console.error(err);
addAlert &&
addAlert({
title: 'Something went wrong',
variant: AlertVariant.danger,
description: 'There was a problem updating the integration. Please try again later.',
});
setIsError(true);
}

Expand All @@ -147,17 +158,9 @@ const Dashboard = () => {
const newSteps = viewData.steps;
newSteps[oldStepIndex] = newStep;

updateIntegration(newSteps)
.then(() => {
addAlert &&
addAlert({
title: 'Step replaced',
variant: AlertVariant.success,
});
})
.catch((e) => {
console.error(e);
});
updateIntegration(newSteps).catch((e) => {
console.error(e);
});
};

/**
Expand Down

0 comments on commit 7dfba79

Please sign in to comment.