Binding data to user (firebase)


#1

So I have created working user authentication, and a page which contains 3 inputs and a “create user” button.
The data form inputs is pushed to firebase, but I don’t think it is binded to the logged user.

here is code:

export class ProfilePage {

  profileData: AngularFireObject<Profile>
  
  profile = {} as Profile;

  constructor(private afAuth: AngularFireAuth, private afDatabase: AngularFireDatabase,
    public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    
    console.log('ionViewDidLoad ProfilePage');
  }

  createProfile() {
    this.afAuth.authState.take(1).subscribe(auth => {
      this.afDatabase.object(`profile/${auth.uid}`).set(this.profile)
        .then(() => this.navCtrl.setRoot(MainPage));
    })
  }
}

the data on firebase looks like this: