Spaces:
Running
Running
Upload 9 files
Browse files- src/services/auth.js +3 -1
src/services/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 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,
|
|
@@ -20,6 +20,7 @@ const SUPER_ADMIN_EMAIL = "t92206@gmail.com";
|
|
| 20 |
*/
|
| 21 |
export async function signInWithGoogle() {
|
| 22 |
try {
|
|
|
|
| 23 |
const result = await signInWithPopup(auth, googleProvider);
|
| 24 |
return result.user;
|
| 25 |
} catch (error) {
|
|
@@ -34,6 +35,7 @@ export async function signInWithGoogle() {
|
|
| 34 |
*/
|
| 35 |
export async function signInWithGoogleRedirect() {
|
| 36 |
try {
|
|
|
|
| 37 |
await signInWithRedirect(auth, googleProvider);
|
| 38 |
// Does not return value, page will redirect
|
| 39 |
} catch (error) {
|
|
|
|
| 1 |
import { auth, googleProvider, db } from "./firebase.js";
|
| 2 |
+
import { signInWithPopup, signInWithRedirect, signOut, getRedirectResult, setPersistence, browserLocalPersistence } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js";
|
| 3 |
import {
|
| 4 |
doc,
|
| 5 |
getDoc,
|
|
|
|
| 20 |
*/
|
| 21 |
export async function signInWithGoogle() {
|
| 22 |
try {
|
| 23 |
+
await setPersistence(auth, browserLocalPersistence);
|
| 24 |
const result = await signInWithPopup(auth, googleProvider);
|
| 25 |
return result.user;
|
| 26 |
} catch (error) {
|
|
|
|
| 35 |
*/
|
| 36 |
export async function signInWithGoogleRedirect() {
|
| 37 |
try {
|
| 38 |
+
await setPersistence(auth, browserLocalPersistence);
|
| 39 |
await signInWithRedirect(auth, googleProvider);
|
| 40 |
// Does not return value, page will redirect
|
| 41 |
} catch (error) {
|