Skip to content

Commit

Permalink
attending feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraPinilla committed Jul 29, 2024
1 parent 3bf091c commit 5db9e95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function GoogleSignIn({ customButtons, socialSignOnIn, className }) {
iconLeft={GoogleIcon}
className={`${className}__Google`}
onClick={() =>
window.google.accounts.id.prompt((notification) => {
window?.google?.accounts?.id?.prompt((notification) => {
if (notification.isSkippedMoment()) {
// https://developers.google.com/identity/gsi/web/reference/js-reference
// https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,21 @@ function useSocialSignIn(
}, [Identity, config.facebookAppId, customButtons]);

useEffect(() => {
let timeout;
const checkIsLoggedIn = () => {
const timeout = setTimeout(() => {
timeout = setTimeout(() => {
Identity.isLoggedIn().then((isLoggedIn) => {
if (isLoggedIn) {
window.location = validateURL(redirectURL);
}
});
}, 1500);
return () => clearTimeout(timeout)
};

const setIdentityUpdated = () => {
const timeout = setTimeout(() => {
timeout = setTimeout(() => {
setUpdateIdentities((prev) => !prev);
}, 1500);
return () => clearTimeout(timeout)
};

if (customButtons && isFBInitialized && !isFBEventSubscribed && window?.FB?.Event) {
Expand All @@ -163,6 +162,7 @@ function useSocialSignIn(
}
});
}
return () => clearTimeout(timeout);
}, [
isFBInitialized,
isFBEventSubscribed,
Expand All @@ -174,11 +174,6 @@ function useSocialSignIn(
redirectURL,
]);






return {
// if facebook and google setup with subs,
// then they will have a truthy value here
Expand Down

0 comments on commit 5db9e95

Please sign in to comment.