Reputation: 909
I need to obtain data of the user who is logging in. I use firebase.auth().onAuthStateChanged to see if the user is logged in and I console.log the userData returned.
It returns all the user's data, see below, but I cannot find how to retrieve it. I can retrieve userData.email, userData.fullname and userData.uid which I know come from the authorization but the other data is there. I know I could use the uid to read the data agaib but it is already there.
I would be very grateful if someone could help me.
confirm:"new" email:"[email protected]" fullname:"john Varified" paytype:"d" registrationDate:"Sat Sep 23 2017" theme:"grey" uid:"FWOb7eJ38veRXQ7wadk77YzhyMj1"
Upvotes: 0
Views: 566
Reputation: 909
Thanks to Essential Courses on Udemy.com I found my missing link. I needed a service to set and destroy a local image.
export class User2memoryService {
constructor() {}
set(userFromDb) {
localStorage.setItem('user', JSON.stringify(userFromDb));
}
destroy() {
localStorage.removeItem('user');
}
}
Upvotes: 1