-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refactor auth to async await #548
Conversation
85a8662
to
819d46e
Compare
819d46e
to
11b51f1
Compare
|
||
return spinner(lbl).then(() => { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are dropping spinner here? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two reasons:
- it prints
Waiting...
and then is clears it a few seconds later. Seems not very helpful - the way previous code was written means it cleared the spinner after getting the value back, i a promise chain couldn't see a nice way to add this into the refactored code as we return the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could return "testAuthComplete().then(spinner.clear)"
But if you feel that the spinner was useless, LET IT DIE.
const apiUrl = url.parse(config.API); | ||
const authUrl = apiUrl.protocol + '//' + apiUrl.host; | ||
const debug = Debug('snyk-auth'); | ||
let attemptsLeft = 0; | ||
|
||
module.exports = auth; | ||
|
||
function resetAttempts() { | ||
attemptsLeft = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
30 is a lot. Do you know how was this number chosen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't perhaps worth asking in slack, it does seem like a lot
|
||
return spinner(lbl).then(() => { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could return "testAuthComplete().then(spinner.clear)"
But if you feel that the spinner was useless, LET IT DIE.
🎉 This PR is included in version 1.172.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What does this PR do?
async/await
instead of promisesWhere should the reviewer start?
auth/index.ts
How should this be manually tested?
npm run build
& then test out usingsnyk auth