chore: 使用同步尝试去除onetap

This commit is contained in:
liuweiqing 2024-03-09 23:01:03 +08:00
parent c8f3a94520
commit 2f60e65f91

View File

@ -22,30 +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: false, // 根据需要设置
// itp_support: true,
// });
// };
// 初始化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) => {