superagent global 401 handler
See original GitHub issueI am using superagent to do my ajax data fetching job.
request
.get('/some/end/point')
.end(function(err, res) {
if (err && res.status === 401) {
// redirect to login
}
// do something with res.body
});
many of my request need authentication check,
but is that possible to config if (err && res.status === 401) {}
globally?
or I should repeat the code in every request I make ?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
superagent global 401 handler · Issue #856 - GitHub
I am using superagent to do my ajax data fetching job. request .get('/some/end/point') .end(function(err, res) { if (err && res.status ...
Read more >Handling 401 Unauthorised responses with visionmedia ...
I am trying to catch the 401 Unauthorised request with superagent, then handle the token refresh. The problem is superagent is not returning ......
Read more >node_modulesold/superagent/docs · master - GitLab
SuperAgent is light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve after being frustrated with many of the existing ......
Read more >superagent - npm
Small progressive client-side HTTP request library, and Node.js module with the same API, supporting many high-level HTTP client features.
Read more >@lakca/superagent-toolkit NPM | npm.io
Superagent plugin, providing frequently used tools, like reporting message of current request, directly retrieving specific property of response, etc.
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 can use like this:
@allces