Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): refactor add and remove Related Terms tab message to showcas… #9338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function AddRelatedTermsModal(props: Props) {
const [AddRelatedTerms] = useAddRelatedTermsMutation();

function addTerms() {
message.loading({ content: 'Adding...' });
AddRelatedTerms({
variables: {
input: {
Expand All @@ -43,19 +44,19 @@ function AddRelatedTermsModal(props: Props) {
},
},
})
.catch((e) => {
message.destroy();
message.error({ content: `Failed to move: \n ${e.message || ''}`, duration: 3 });
})
.finally(() => {
message.loading({ content: 'Adding...', duration: 2 });
.then(() => {
setTimeout(() => {
refetch();
message.destroy();
message.success({
content: 'Added Related Terms!',
duration: 2,
});
refetch();
}, 2000);
})
.catch((e) => {
message.destroy();
message.error({ content: `Failed to move: \n ${e.message || ''}`, duration: 3 });
});
onClose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ function useRemoveRelatedTerms(termUrn: string, relationshipType: TermRelationsh
const [removeRelatedTerms] = useRemoveRelatedTermsMutation();

function handleRemoveRelatedTerms() {
message.loading({
content: 'Removing...',
});
removeRelatedTerms({
variables: {
input: {
Expand All @@ -21,22 +24,19 @@ function useRemoveRelatedTerms(termUrn: string, relationshipType: TermRelationsh
},
},
})
.catch((e) => {
message.destroy();
message.error({ content: `Failed to remove: \n ${e.message || ''}`, duration: 3 });
})
.finally(() => {
message.loading({
content: 'Removing...',
duration: 2,
});
.then(() => {
setTimeout(() => {
refetch();
message.destroy();
message.success({
content: `Removed Glossary Term!`,
duration: 2,
});
}, 2000);
})
.catch((e) => {
message.destroy();
message.error({ content: `Failed to remove: \n ${e.message || ''}`, duration: 3 });
});
}

Expand Down