I am trying to write a signout method.Before signing out im trying to unsubscribe my previous subscribtions otherwise i get many subscribe and permission errors
this is signout method(button click triggers this)
console.log(this.profileData);
this.profileData.unsubscribe();
this.app.auth().signOut().then(function() {
alert("you successfully signed out");
}, function(error) {
alert("error");
});
this is how i subscribe
this.profileData = this.fire.authState.switchMap(auth => this.db.object(`profile/${auth.uid}`).valueChanges());
this.profileData.subscribe(profile =>{...
