D
D
Denis Bukreev2019-04-05 10:31:03
Vue.js
Denis Bukreev, 2019-04-05 10:31:03

Is it possible to subscribe to all axios requests in Vue?

For each request with the API, certain server errors can be returned (for example, the limit of requests per minute) and I would like to process them in one function.
But calling the handler function in the catch of each request is somehow not Feng Shui.
Is there a way to subscribe to all requests, or better yet, to all request errors?
After all, for example, you can set uniform headers for all requests.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2019-04-05
@denisbookreev

That 's what interceptors are for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question