Advertisement
Guest User

Untitled

a guest
Oct 13th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. export class LoginComponent {
  2. /*@ngInject*/
  3.  
  4. constructor(Auth, $state) {
  5. this.Auth = Auth;
  6. this.$state = $state;
  7. this.errors = {login: ''};
  8. }
  9.  
  10. login(form) {
  11. this.submitted = true;
  12.  
  13. const user = {
  14. email: this.user.email,
  15. password: this.user.password
  16. };
  17.  
  18. if (form.$valid) {
  19. this.Auth.login(user)
  20. .then(
  21. (data) => {
  22. this.errors.login = data;
  23. // Logged in, redirect to home
  24. //this.$state.go('main');
  25. },
  26. (err) => {
  27. this.errors.login = err;
  28. }
  29. );
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement