Advertisement
Guest User

Untitled

a guest
May 10th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  login(){
  2.     this.af.auth.login({
  3.  
  4.       email: this.email,
  5.       password: this.password
  6.  
  7.     },{
  8.       provider: AuthProviders.Password,
  9.       method: AuthMethods.Password
  10.  
  11.     }).then((response)=>{
  12.      // console.log('Login geslaagd' + JSON.stringify(response));
  13.     //  console.log(this.email);
  14.      // console.log(this.password);
  15.       let currentuser = {
  16.         email: response.auth.email,
  17.         picture: response.auth.photoURL,
  18.         userUID: response.auth.uid
  19.  
  20.       };
  21.       //console.log("current user mail "+ currentuser.userUID);
  22.       window.localStorage.setItem('currentuserEmail',JSON.stringify(currentuser.userUID));
  23.  
  24.       window.localStorage.setItem('currentuser', JSON.stringify(currentuser))
  25.  
  26.  
  27.       this.navCtrl.setRoot(HomePage);
  28.       //this.navCtrl.push(HomePage);
  29.     })//.then((response) => {
  30.       //this.navCtrl.push(HomePage);
  31.       //}
  32.  
  33.  
  34.       .catch((error)=> {
  35.         this.tonenErrorPopUp(error);
  36.       console.log(error);})
  37.   }
  38.  
  39.   tonenErrorPopUp(error){
  40.     setTimeout(() => {});
  41.     let prompt = this.alertCtrl.create({
  42.       title: 'Fail',
  43.       subTitle: error,
  44.       buttons: ['ok']
  45.     });
  46.     prompt.present();
  47.  
  48.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement