How to Make Axios AbortController Wait for Server Response?

I’m using axios for my http requests, and AbortController to abort them.

And I figured that running conroller.abort() will throw an error immediatly and doesn’t wait for the server response, and the server sometime will keep processing until it hits the request cancelled at last, i.e. after running the process completely.

So I want to wait for the server after the abort is called, if the server returned my custom status code 499 then it’s canceled safely, otherwise, run the normal process for success or error codes.

Does cancelToken.source() work in this case, and is it recommended?