Documentation needs to say that refreshAuthLogic needs to return the axios instance
See original GitHub issueThank for you this package. Very useful. First of all, having to use skipWhileRefreshing: false is required for the desired behavior of the package, and I’d urge you to make this the default behavior. Other people seem to have suggested this already, and you have promised to make it so. Thank you for that. Please make it happen. 👍
Secondly, documentation is unclear. It needs to mention that refreshAuthLogic needs to return the axios instance:
const refreshAuthLogic = (failedRequest: any): Promise<any> => {
return axios.post(...).then(...);
}
The return is missing from the documentation and leads to errors.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:7 (4 by maintainers)
Top Results From Across the Web
The request does not return to its original promise and ...
const refreshAuthLogic = (failedRequest) => axios .post(`${process.env. ... It's basically needed only when you're not able to use ...
Read more >Trying to get axios-auth-refresh working with NodeJS
I had missed an important point, the refreshAuthLogic function actually needs to return the axios instance instance .
Read more >The Axios Instance | Axios Docs
You can create a new instance of axios with a custom config. ... const instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, ...
Read more >@blueberry6401/axios-auth-refresh - npm
All the new requests created while the refreshAuthLogic has been processing will be bound onto the Promise returned from the ...
Read more >Using axios.all to make concurrent requests - LogRocket Blog
Then, using the GET method on the Axios instance to make a request ... file to reflect that the axios.all helper method has...
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 Free
Top 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

I plan to include this change in v3.0.0 [PR #105].
Hi @thomergil, thanks for submitting the issue.
Yes I’m aware that
skipWhileRefreshing: falseis required and I plan to change it as soon as possible in the v3 of the library.Please, understand this is something I do in my free time while I’m working on other projects/libraries. If you’d like to fast-forward the development process, please consider contributing if that’s something you’d be able to do. I’d be more than happy to do a code review & accept any pull requests on this package.
When it comes to the documentation, there’s no
returnstatement because of how the arrow functions work. When only one statement is executed and there’s no wrapping curly braces{}the statement will be returned automatically. Although it’s correct, I agree that the function can be written in{}and return the statement, so the people seeing it will actually realise that the return is necessary for the library to work.