Spaces:
Running
Running
Upload 9 files
Browse files- src/services/auth.js +4 -2
src/services/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { auth, googleProvider, db } from "./firebase.js";
|
| 2 |
-
import { signInWithPopup, signInWithRedirect, signOut } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js";
|
| 3 |
import {
|
| 4 |
doc,
|
| 5 |
getDoc,
|
|
@@ -47,12 +47,14 @@ export async function signInWithGoogleRedirect() {
|
|
| 47 |
* Call this on page load to handle redirect callback
|
| 48 |
*/
|
| 49 |
export async function handleRedirectResult() {
|
|
|
|
| 50 |
try {
|
| 51 |
-
const { getRedirectResult } = await import("https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js");
|
| 52 |
const result = await getRedirectResult(auth);
|
| 53 |
if (result && result.user) {
|
| 54 |
console.log("Redirect Sign-In Successful:", result.user.email);
|
| 55 |
return result.user;
|
|
|
|
|
|
|
| 56 |
}
|
| 57 |
} catch (error) {
|
| 58 |
console.error("Redirect Result Error:", error);
|
|
|
|
| 1 |
import { auth, googleProvider, db } from "./firebase.js";
|
| 2 |
+
import { signInWithPopup, signInWithRedirect, signOut, getRedirectResult } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js";
|
| 3 |
import {
|
| 4 |
doc,
|
| 5 |
getDoc,
|
|
|
|
| 47 |
* Call this on page load to handle redirect callback
|
| 48 |
*/
|
| 49 |
export async function handleRedirectResult() {
|
| 50 |
+
console.log("Checking for redirect result...");
|
| 51 |
try {
|
|
|
|
| 52 |
const result = await getRedirectResult(auth);
|
| 53 |
if (result && result.user) {
|
| 54 |
console.log("Redirect Sign-In Successful:", result.user.email);
|
| 55 |
return result.user;
|
| 56 |
+
} else {
|
| 57 |
+
console.log("No redirect result found.");
|
| 58 |
}
|
| 59 |
} catch (error) {
|
| 60 |
console.error("Redirect Result Error:", error);
|