Searching for the user's article in my Realtime database to display information.
https://i.sstatic.net/yCdgf.png
This is my Ionic script page
Below are the imports I have:
I am able to retrieve the user's ID, but I'm facing difficulty in fetching this real-time data from the database.
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { AngularFireDatabase, AngularFireList } from '@angular/fire/compat/database';
export class Tab3Page {
public profileData: any;
name: string;
prenom: string;
constructor(private afAuth: AngularFireAuth,
private db: AngularFireDatabase,
private toast: ToastController,
private navCtrl: NavController,
private authService: FirebaseAuthServiceService) {
this.afAuth.authState.subscribe(
(res)=>{
this.profileData = res.uid;
console.log(this.profileData);
}
)
this.db.list("users/"+this.profileData).valueChanges().subscribe(details => {
this.name =details["name"];
this.prenom = details["prenom"];
console.log(details);
})
}
}