S
S
Sashqa2021-11-29 10:42:40
Vue.js
Sashqa, 2021-11-29 10:42:40

Loading during API request by flag?

I have a fairly large number of requests sent in the application.
There are both light ones, which are performed in a fraction of a second, and heavy ones, which require more time to process. I want to make one loader component and manage it in the interceptor, but can I somehow do it so that it is not activated for every request, or maybe by some flag in the requests?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2021-11-29
@Sashqa

I would make control through the store, and in the store I would modify the value already from the receiving service - for a specific api call.
I would not get attached to the interceptor.
Well, or generally by timeout - if the request lasts more than 100ms - show the loader.
But in general, I would refuse the global blocking loader, and would use small local loaders (blocking / showing skeletons in separate components). And the global interceptor would only be hung on a strip from above, such as done in ajax bar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question