question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation needs to say that refreshAuthLogic needs to return the axios instance

See original GitHub issue

Thank 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:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Flyrellcommented, Aug 5, 2020

I plan to include this change in v3.0.0 [PR #105].

1reaction
Flyrellcommented, Jun 17, 2020

Hi @thomergil, thanks for submitting the issue.

Yes I’m aware that skipWhileRefreshing: false is 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 return statement 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found