Guest User

Untitled

a guest
Jun 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. export const MEAT_API = 'http://localhost:1337'
  2.  
  3. submit(){
  4. var link = 'http://localhost:1337/user/login';
  5. var data = '?email='+JSON.stringify(this.usuario.email)+'&senha='+ JSON.stringify(this.usuario.senha);
  6.  
  7.  
  8. this.http.post(link, data)
  9. .subscribe(data => {
  10. this.data.response = data._body;
  11.  
  12. if(this.data.response != "[]"){
  13. var resposta = this.data.response;
  14. console.log(resposta);
  15.  
  16. // tinha que pegar o ID do usuário.... :/
  17. sessionStorage.setItem("usuarioEmail", this.usuario.email);
  18. //sessionStorage.setItem("idUsusario", resposta[0].idusuarios);
  19. sessionStorage.setItem("flagLogado", "sim");
  20.  
  21. this.navCtrl.setRoot(WellFitPage, {}, {animate: true, direction: "forward"});
  22. }else{
  23. let alert = this.alertCtrl.create({
  24. title: 'Usuário Não encontrado!',
  25. subTitle: 'Verifique se digitou seu e-mail e senha corretamente.',
  26. buttons: ['OK']
  27. });
  28. alert.present();
  29. }
  30. })
  31. }
Add Comment
Please, Sign In to add comment