cello icon indicating copy to clipboard operation
cello copied to clipboard

Fix deleteAgent API call message always succeeds

Open dodo920306 opened this issue 6 months ago • 2 comments

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.

dodo920306 avatar Jun 14 '25 13:06 dodo920306

The build for this may also fail because the package.json is still unfixed.

dodo920306 avatar Jun 14 '25 13:06 dodo920306

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?

dodo920306 avatar Jun 14 '25 13:06 dodo920306