requestComplete hook and preventing double requests #585
Closed
ivan-suhorukov
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
try {
isShowingSpinner = true;
await ky(…);
} finally {
isShowingSpinner = false;
} If you need it in multiple places, you can just wrap it in a reusable function.
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'm trying to create a SPA application with ky, so i want to show a loader on the page on each request. I can show it on
beforeRequest
, but i cannot hide it on offline-error requests. When i put the hiding code inbeforeError
its just not firing. Have i any possibility to hide loader after each request? Maybe we needrequestComplete
hook?Is there a method to prevent a double-request logical errors? Lets say when user resort items with slow connection i don't want to apply new resorting requests at the same time, i want to reject all requests but first. Maybe there is need of
requestId
param, so requests with the same Id cannot fire at the same time?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions