Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Await GoogleAuth to finish initialization #382

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ignore if unmounted
  • Loading branch information
ranihorev committed Oct 15, 2020
commit 123f41297c4b3f63dbab8d1c95c4f2f6abc05a4c
5 changes: 4 additions & 1 deletion src/use-google-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,14 @@ const useGoogleLogin = ({
} else {
GoogleAuth.then(
() => {
if (unmounted) {
return
}
if (isSignedIn && GoogleAuth.isSignedIn.get()) {
setLoaded(true)
onAutoLoadFinished(true)
handleSigninSuccess(GoogleAuth.currentUser.get())
} else if (!unmounted) {
} else {
setLoaded(true)
onAutoLoadFinished(false)
}
Expand Down