Skip to content

Updated the getAuthObject method to get the current user's access_token#15

Open
Guiradi wants to merge 1 commit intovertcitron:masterfrom
Guiradi:master
Open

Updated the getAuthObject method to get the current user's access_token#15
Guiradi wants to merge 1 commit intovertcitron:masterfrom
Guiradi:master

Conversation

@Guiradi
Copy link
Copy Markdown

@Guiradi Guiradi commented Feb 5, 2020

Updated the getAuthObject method for fetch the current user's auth session data

@Guiradi Guiradi requested a review from vertcitron February 5, 2020 22:07
Copy link
Copy Markdown
Owner

@vertcitron vertcitron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for keeping alive this little piece!
As I ask further in a code comment, I just want to understand why a resolved promise with a null in place of a rejected promise with an ad-hoc message when not logged?

if (auth.isSignedIn.get()) {
return Promise.resolve(_formatAuthObject(auth.currentUser.get()))
} else {
return Promise.resolve(null)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason to return a null resolved promise in place of a rejected one with a not logged message?
A rejected promise should be more universal and more readable no?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vertcitron I'd say it is to remain consistent with the behavior of currentUser() defined below.

@vertcitron
Copy link
Copy Markdown
Owner

I merged a security fix on the upstream master, so if you change something on your PR, please rebase on it before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants