Base functionality with SDK44.
This commit is contained in:
@@ -2,11 +2,17 @@ import firebase from "firebase/app";
|
||||
import "firebase/auth";
|
||||
import env from "../env";
|
||||
|
||||
if (!firebase.apps.length) {
|
||||
firebase.initializeApp(env.firebase);
|
||||
}
|
||||
import { initializeApp } from "firebase/app";
|
||||
import { getAuth, initializeAuth } from "firebase/auth";
|
||||
import { getReactNativePersistence } from "firebase/auth/react-native";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
|
||||
const defaultApp = initializeApp(env.firebase);
|
||||
initializeAuth(defaultApp, {
|
||||
persistence: getReactNativePersistence(AsyncStorage),
|
||||
});
|
||||
export const auth = getAuth();
|
||||
|
||||
export const auth = firebase.auth();
|
||||
//export const analytics = firebase.analytics();
|
||||
|
||||
export default firebase;
|
||||
@@ -19,14 +25,3 @@ export const getCurrentUser = () => {
|
||||
}, reject);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCurrentUser = (userDetails) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const unsubscribe = auth.onAuthStateChanged((userAuth) => {
|
||||
userAuth.updateProfile(userDetails).then((r) => {
|
||||
unsubscribe();
|
||||
resolve(userAuth);
|
||||
});
|
||||
}, reject);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user