Hey there,
I have a problem, I think that is a stupid thing.
When a user logs in, I need to get user details from Firebase e put them in a profile page.
This is the function in profile.ts:
getData() {
var uid = this.authProvider.afAuth.auth.currentUser.uid
var account = this.accountProvider.getData(uid)
console.log(uid);
}
Instead in provider:
getData(uid){
return this.afDB.database.ref('/Users/' + uid).once('value').then(function(snapshot) {
var account = {
nome: snapshot.child("Name").val(),
cognome: snapshot.child("Surname").val(),
data_di_nascita: snapshot.child("Birthday").val(),
sesso: snapshot.child("Sex").val(),
titolo_di_studio: snapshot.child("Qualification").val()
}
console.log(account);
});
}
Iām able to get data, because I tried to view the variable account and all work fine.
But, what is the return of the function? How can I create an array in profile.ts with those data?
Seems that this is wrong.
var account = this.accountProvider.getData(uid)
Can someone help me?
Thank you!