Track "state" of http request.
See original GitHub issueOften elements in a page will show/hide based on the state of the http request.
this.registerState = 'sending';
this.$http.post('/auth/register, {}, function () {
this.registerState = 'sent';
}, function () {
this.registerstate = 'error';
});
This can get extremely redundant. It would be nice if there was a parameter that could be set for the request and the contexts data would automatically get updated.
this.$http.post('/auth/register, {}, function () {
}, {
state: 'registerState'
});
Then in our view we just have access to registerState
and don’t need to constantly write up the logic.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
HTTP request methods - MDN Web Docs
Chrome Edge
CONNECT Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history
DELETE Full support. ChromeYes. Toggle history Full support. Edge12. Toggle history
GET Full...
Read more >Track state of HTTP request and add / remove spinner on ...
I need to create a spinner, wait for downloading to be ready and remove the spinner. jQuery code I've written: $(document).ajaxStart(apex.
Read more >HTTP - Methods - Tutorialspoint
TRACE Method. The TRACE method is used to echo the contents of an HTTP Request back to the requester which can be used...
Read more >HTTP State Management
HTTP is a stateless (or non-persistent) protocol. Each request is treated by its own. A request will not know what was done in...
Read more >HTTP/1.1: Method Definitions
TRACE allows the client to see what is being received at the other end of the request chain and use that data for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could do this via the third argument on a request and attaching a callback to the xhr object.
I know it’s not a question, i was simply stating it was possible at present even though i prefer your proposal.
That being said, it would also be nice to extend this out to track request progress too which would be useful for displaying upload/download progress.
I have updated my example to cover all states rather than just progress.