IO-1364 Update profile changes for new firebase package.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user