Guest User

Untitled

a guest
Dec 11th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. loginWithFB(userData) {
  2.  
  3.  
  4. this.fb.login(['email', 'public_profile']).then((response: FacebookLoginResponse) => {
  5. this.fb.api('me?fields=id,name,email,first_name,picture.width(720).height(720).as(picture_small)', []).then(profile => {
  6. this.userData = { email: profile['email'], first_name: profile['first_name'], picture: profile['picture_small']['data']['url'], username: profile['name'] }
  7.  
  8. if (this.userData != "") {
  9.  
  10. this.navCtrl.setRoot(HomePage, { 'logfb': this.userData })
  11.  
  12. this.events.publish('loginfacebook', this.userData, Date.now());
  13. // this.navCtrl.push(HomePage, {
  14. // 'logfb': this.userData
  15. // });
  16. } else {
  17. let toast = this.toastCtrl.create({ duration: 3000, position: 'bottom'
  18. });
  19. toast.setMessage('Não foi possível logar com Facebook');
  20. toast.present();
  21. }
  22. })
  23.  
  24. });
Add Comment
Please, Sign In to add comment