spotty-amberS
Refine3y ago
5 replies
spotty-amber

How to set global error and success notification?

I want to set the notification for error and success of API calls globally. Is there a way to implement that? Because in almost all of my error on API call I am duplicating the code with displaying the response error message from the API. For example my API will response error in 4xx as below:
{
  status: false,
  code: 400,
  message: "Some error message that is related to validation",
  details: {}
}

Here I want my error notification to display the message from this response whenever my status lies between 4xx.
Was this page helpful?