From c8f3a945205b11373df2809f916d3d15bcf6bdc6 Mon Sep 17 00:00:00 2001 From: liuweiqing Date: Sat, 9 Mar 2024 22:58:23 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BD=BF=E7=94=A8=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=8E=BB=E9=99=A4onetap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/GoogleSignIn.tsx | 60 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/components/GoogleSignIn.tsx b/components/GoogleSignIn.tsx index 0347c3b..d54e9d5 100644 --- a/components/GoogleSignIn.tsx +++ b/components/GoogleSignIn.tsx @@ -22,34 +22,30 @@ const GoogleSignIn = () => { checkSession(); }, []); - const loadGoogleSignInScript = () => { - // 确保gapi脚本只被加载一次 - if (!window.gapi) { - const script = document.createElement("script"); - script.src = "https://accounts.google.com/gsi/client"; - script.async = true; - script.defer = true; - script.onload = initGoogleSignIn; - document.body.appendChild(script); - } else { - initGoogleSignIn(); - } - }; + // const loadGoogleSignInScript = () => { + // // 确保gapi脚本只被加载一次 + // if (!window.gapi) { + // const script = document.createElement("script"); + // script.src = "https://accounts.google.com/gsi/client"; + // script.async = true; + // script.defer = true; + // script.onload = initGoogleSignIn; + // document.body.appendChild(script); + // } else { + // initGoogleSignIn(); + // } + // }; - // 初始化Google登录 - const initGoogleSignIn = () => { - window.google.accounts.id.initialize({ - client_id: - "646783243018-m2n9qfo12k70debpmkesevt5j2hi2itb.apps.googleusercontent.com", // 替换为你的客户端ID - callback: handleSignInWithGoogle, - auto_select: true, // 根据需要设置 - itp_support: true, - }); - window.google.accounts.id.renderButton( - document.getElementById("g_id_signin"), - { theme: "outline", size: "large" } - ); - }; + // // 初始化Google登录 + // const initGoogleSignIn = () => { + // window.google.accounts.id.initialize({ + // client_id: + // "646783243018-m2n9qfo12k70debpmkesevt5j2hi2itb.apps.googleusercontent.com", // 替换为你的客户端ID + // callback: handleSignInWithGoogle, + // auto_select: false, // 根据需要设置 + // itp_support: true, + // }); + // }; // 处理登录响应 const handleSignInWithGoogle = async (response) => { @@ -70,6 +66,16 @@ const GoogleSignIn = () => { return (
+