Skip to content

Commit

Permalink
Improve merge feedback message (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
joanagmaia authored Jan 8, 2024
1 parent e183425 commit 819884f
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,17 @@ const handleMergeMembers = async () => {
fetchMembers({ reload: true });
})
.catch(() => {
.catch((error) => {
Message.closeAll();
Message.error('Error merging contacts');
if (error.response.status === 404) {
Message.error('Contacts already merged or deleted', {
message: `Sorry, the contacts you are trying to merge might have already been merged or deleted.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error merging contacts');
}
});
};
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/modules/member/components/member-merge-dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ const mergeSuggestion = () => {
fetchMembers({ reload: true });
}
})
.catch(() => {
Message.error('There was an error merging contacts');
.catch((error) => {
if (error.response.status === 404) {
Message.error('Contacts already merged or deleted', {
message: `Sorry, the contacts you are trying to merge might have already been merged or deleted.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error merging contacts');
}
})
.finally(() => {
sendingMerge.value = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,15 @@ const ignoreSuggestion = () => {
Message.success('Merging suggestion ignored successfuly');
fetch();
})
.catch(() => {
Message.error('There was an error ignoring the merging suggestion');
.catch((error) => {
if (error.response.status === 404) {
Message.error('Suggestion already merged or ignored', {
message: `Sorry, the suggestion you are trying to merge might have already been merged or ignored.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error ignoring the merging suggestion');
}
})
.finally(() => {
sendingIgnore.value = false;
Expand All @@ -288,8 +295,15 @@ const mergeSuggestion = () => {
Message.success('Contacts merged successfuly');
fetch();
})
.catch(() => {
Message.error('There was an error merging contacts');
.catch((error) => {
if (error.response.status === 404) {
Message.error('Contacts already merged or deleted', {
message: `Sorry, the contacts you are trying to merge might have already been merged or deleted.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error merging contacts');
}
})
.finally(() => {
sendingMerge.value = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,17 @@ const handleMergeOrganizations = async () => {
fetchOrganizations({ reload: true });
})
.catch(() => {
.catch((error) => {
Message.closeAll();
Message.error('There was an error merging organizations');
if (error.response.status === 404) {
Message.error('Organizations already merged or deleted', {
message: `Sorry, the organizations you are trying to merge might have already been merged or deleted.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error merging organizations');
}
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,16 @@ const mergeSuggestion = () => {
changeOrganization();
})
.catch(() => {
.catch((error) => {
Message.closeAll();
Message.error('There was an error merging organizations');
if (error.response.status === 404) {
Message.error('Organizations already merged or deleted', {
message: `Sorry, the organizations you are trying to merge might have already been merged or deleted.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error merging organizations');
}
})
.finally(() => {
sendingMerge.value = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,15 @@ const ignoreSuggestion = () => {
Message.success('Merging suggestion ignored successfuly');
fetch();
})
.catch(() => {
Message.error('There was an error ignoring the merging suggestion');
.catch((error) => {
if (error.response.status === 404) {
Message.error('Suggestion already merged or ignored', {
message: `Sorry, the suggestion you are trying to merge might have already been merged or ignored.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error ignoring the merging suggestion');
}
})
.finally(() => {
sendingIgnore.value = false;
Expand Down Expand Up @@ -313,9 +320,17 @@ const mergeSuggestion = () => {
fetch();
})
.catch((e) => {
.catch((error) => {
Message.closeAll();
Message.error('There was an error merging organizations');
if (error.response.status === 404) {
Message.error('Organizations already merged or deleted', {
message: `Sorry, the organizations you are trying to merge might have already been merged or deleted.
Please refresh to see the updated information.`,
});
} else {
Message.error('There was an error merging organizations');
}
})
.finally(() => {
sendingMerge.value = false;
Expand Down

0 comments on commit 819884f

Please sign in to comment.