Hi i'm implementing a FB login flow on my site with React. When the button is clicked it calls an external JS file that starts the login flow. My problem is I need to pass back true/false to see if they successfully logged in and then render a react component, but the JS function instantly returns undefined or false, not waiting for the FB Api call. The function looks like this
login: function(){
console.log('login');
FB.login(function(response){
if(response.authResponse){
return(externalScriptThatImIn.checkLoginStateStarter());
}
},{scope:"public_profile,email"});
},
and then the function it calls returns another function which eventually goes to a return true or false based on if they got logged in, but even if I say return true; right in the FB.login call it doesn't wait for it to evaluate before returning and just returns undefined. Is there anyway to force it to wait?