I'm facing a minor issue with Facebook login in Ionic. I've tried using Async - Await and various other methods to make it wait for the response, but nothing seems to work. The login function is working fine, but it's not pausing for me to process the response.
Any suggestions on how I can add a delay here? I understand that this might be considered callback hell, but all I need is to fetch some basic information.
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
constructor(public navCtrl: NavController,
public navParams: NavParams,
public fb: Facebook) {
doFacebookLogin(){
let env = this;
this.fb.login(permissions)
.then(function(response){
env.fb.api("/me?fields=name", params)
.then(function(user) {
//
// process user data here
//
})
}, function(error){
console.log(error);
});
}
Thanks! Phil