I have a question regarding the handling of blocking internal events

Hello,

I want to use the code snippet below to prevent a request from being sent to the backend service by intercepting the ‘delete-car’ event. The intention is to only delete the card from the frontend UI without making a request to the backend when the api.intercept returns false. However, even when api.intercept returns false, the card is not removed from the UI.

api.intercept('delete-car', (obj) => {
  if (obj === 12) {
    return false;
  }
  return true;
});

Could you please advise on how to correctly implement this requirement? Is it appropriate to use api.intercept for this purpose?

Good day @jmh.yy ,

When you return false in the board.api.intercept(‘delete-card’, …), it blocks the delete operation in all its variants.

There is a skipProvider flag to prevent a request from being sent to the server (see the information at the end of the article chapter).

So, use

board.api.intercept('delete-card', (obj) => {
        if (obj.id === 12) {
            obj.skipProvider = true;
        }      
});

This flag can be passed to the board.api.intercept and its callback obj parameter or to the board.api.exec and its config parameter as well.