Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70445

Logout function and fetching user data on same page not working in ionic using firebase

$
0
0

@aditbharadwaj wrote:

i have a account page in which iam calling firebase.auth for 2 things , first is for SignOut function and 2nd is to call current user data. i cant use the same variable for both functionalities in different function

So when iam assigning a variable for firbase.auth to use for calling the user data i cant use the same variable in 2nd function to call signOut() as it says that variable is not a function. so how can i assing a single variable for both the functionalities iam missing something . please help

Constructor for the account.ts page which also fetch user data on entering the page

constructor(public platform: Platform, public statusBar: StatusBar,public nav: Nav, public app: App, public auth: Auth,
        public splashScreen: SplashScreen, public alertCtrl: AlertController, 
        public values: Values, public translateService: TranslateService, public navCtrl: NavController , public service: Service,
        ){
            //this.fireAuth = firebase.auth();

            this.currentUser = firebase.auth().currentUser;


      if(this.values.isLoggedIn){
        this.service.getUserProfile(this.currentUser.uid).on('value', (snapshot) =>{
         this.userProfiles = snapshot.val();

        });
      } 

    console.log(this.userProfiles);

      this.form = {};
      this.auth = auth;
    this.form.in_stock = true;
      this.form.vendor = "";
      this.form.brand = "";
      this.form.sale_price = "";

      this.customerList = firebase.database().ref('/Customer-List'); 
      this.zone = new NgZone({});


  }

Logout function where i cant use currentUser(it is use to call firebase.auth() function) again as it says it is not a fucntion

 logOut(){

     this.currentUser.signOut();
      console.log('logged out');
      this.app.getRootNavs()[0].setRoot(SigninPage);

}

I want to use both functionalities on same page .

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>