Skip to content

Commit

Permalink
fix: gsi call after script load (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
120EE0692 authored Oct 10, 2023
1 parent 98d01e2 commit 439d938
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/src/components/onboarding/stages/Welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Welcome({
}
}

function gis() {
function gsi() {
google.accounts.id.initialize({
client_id: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
callback: handleCredentialResponse,
Expand All @@ -70,7 +70,11 @@ function Welcome({
);
google.accounts.id.prompt();
}
gis();
const script = document.createElement('script');
script.src = 'https://accounts.google.com/gsi/client';
script.strategy = 'beforeInteractive';
script.onload = gsi;
document.head.appendChild(script);
}, []);

return (
Expand Down

0 comments on commit 439d938

Please sign in to comment.