Почему авторизации на телефоне, не переходит на страницу профиля. На пк все работает отлично
производил авторизацию благодаря firebase authentication + firestore database. На пк после входа переходит на страницу профиля, а с телефона нет. Вот мой код
googleSignInButton.addEventListener("click", async () => {
googleSignInButton.disabled = true;
try {
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
await signInWithRedirect(auth, provider);
} else {
const result = await signInWithPopup(auth, provider);
const user = result.user;
console.log("User signed in: ", user);
const userDocRef = doc(db, "users", user.uid);
const docSnap = await getDoc(userDocRef);
if (!docSnap.exists()) {
await setDoc(userDocRef, {
uid: user.uid,
email: user.email,
displayName: user.displayName,
balance: 0,
cardStatus: false
});
console.log("User added to Firestore");
}
window.location.href = "https://unis2.store/maldenaHealth/profile";
}
} catch (error) {
console.error("Error during Google sign-in: ", error.message);
} finally {
googleSignInButton.disabled = false;
}
});