I'm trying to update af user's profile with updateProfile()
When I call the function exactly as the example from the link above, it throws the TypeError: currentUser.updateProfile is not a function
. I tried to console.log()
the user and weirdly it does not show the updateProfile()
function.
I'm using the user retrieved from auth.onAuthStateChanged()
. I then uses Firebase firestore where I store other user info. I merges that user object with the data retrieved from firestore with:
const mergedUser = Object.assign({}, user, doc.data())
I pass mergedUser
to a useState() currentUser
that is passed to my context provider value.
Everything else works, but the functions that is supposed to be on the userobject is not present after the Object.assign(). How could merge the user object so I can access all userdata AND the firebase user functions, such as updateProfile()
Thank you in advance!
package.json:
{
"name": "planom",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"firebase": "^8.2.7",
"next": "10.0.6",
"react": "17.0.1",
"react-dom": "17.0.1",
"sass": "^1.32.7"
},
"devDependencies": {}
}