How do I check if the page is loading a request? #1575
Unanswered
JoaoHCopetti
asked this question in
Help
Replies: 1 comment
-
Yes, you can do this with Which means, you can do anything you want when the events are fired.
More information: https://inertiajs.com/manual-visits#event-callbacks Ps. Ancient question, I know. I thought I would answer this anyway since this came up in my search result. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For example, I want to make a new request to load some partial data like this:
But I want to show a specific loading spinner where the data is loading, not a progress bar on top of the page.
So a
isLoading
variable would be great to check if that given request is loading.I could do something like that:
But unfortunatelly the
reload
doesn't return a Promise.I also know there's a
router.on('finish')
event, but it's triggered on any request, I would like to know that this specific request is loading, the request I'm asking fordataLazy
variable, not any request.How would I do it? Of course, without add a lot of code in my file, I'm looking for something simple like Axios maybe?
Beta Was this translation helpful? Give feedback.
All reactions