import { initializeApp } from "firebase/app"; import { getAuth } from "firebase/auth"; import env from "../env"; initializeApp(env.firebase); export const auth = getAuth(); // export const unsubscribe = onAuthStateChanged(auth, (user) => { // console.log("Auth State Check", user); // store.dispatch( // user // ? signInSuccess({ // uid: user.uid, // email: user.email, // displayName: user.displayName, // photoURL: user.photoURL, // authorized: true, // }) // : unauthorizedUser() // ); // }); export const getCurrentUser = () => { return new Promise((resolve, reject) => { const unsubscribe = auth.onAuthStateChanged((userAuth) => { unsubscribe(); resolve(userAuth); }, reject); }); };