cello
cello copied to clipboard
Fix deleteAgent API call message always succeeds
Previously, deleteCallback always showed a success message regardless of whether the deleteAgent API call succeeded or failed.
Now it checks response.success before showing the message and only displays a success message when the API call is successful. An error message is shown otherwise.
This prevents misleading user feedback in case of deletion failure.
The build for this may also fail because the package.json is still unfixed.
Also, shall we also combine https://github.com/hyperledger-cello/cello/pull/691/files#diff-403672fc815d806b49ea96bfe9925b72deba54aaba8301d41f86f16ffbeb75ffR286-L285
if (userRole === 'admin') {
dispatch({
type: 'agent/deleteAgent',
payload: agent.id,
callback: this.deleteCallback,
});
} else {
dispatch({
type: 'agent/deleteAgent',
payload: agent.id,
callback: this.deleteCallback,
});
}
because they do the same thing?