IO-1364 Update profile changes for new firebase package.

This commit is contained in:
Patrick Fic
2021-09-20 11:31:13 -07:00
parent 45176cc2e2
commit 61ac520192
5 changed files with 347 additions and 346 deletions

View File

@@ -1,6 +1,6 @@
import { getAnalytics, logEvent } from "firebase/analytics";
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getAuth, updatePassword, updateProfile } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
//import { getMessaging } from "firebase/messaging";
import { store } from "../redux/store";
@@ -25,7 +25,7 @@ export const getCurrentUser = () => {
export const updateCurrentUser = (userDetails) => {
return new Promise((resolve, reject) => {
const unsubscribe = auth.onAuthStateChanged((userAuth) => {
userAuth.updateProfile(userDetails).then((r) => {
updateProfile(userAuth, userDetails).then((r) => {
unsubscribe();
resolve(userAuth);
});
@@ -36,19 +36,7 @@ export const updateCurrentUser = (userDetails) => {
export const updateCurrentPassword = async (password) => {
const currentUser = await getCurrentUser();
return currentUser.updatePassword(password);
// return new Promise((resolve, reject) => {
// const unsubscribe = auth.onAuthStateChanged(
// (userAuth) => {
// userAuth.updatePassword(password).then((r) => {
// unsubscribe();
// resolve(userAuth);
// });
// },
// (error) => reject(error)
// );
// });
return updatePassword(currentUser, password);
};
//let messaging;