Created
October 13, 2016 14:27
-
-
Save marianoqueirel/eba9c8fafcab24821eaeddacfa94b2ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class LoginComponent { | |
/*@ngInject*/ | |
constructor(Auth, $state) { | |
this.Auth = Auth; | |
this.$state = $state; | |
this.errors = {login: ''}; | |
} | |
login(form) { | |
this.submitted = true; | |
const user = { | |
email: this.user.email, | |
password: this.user.password | |
}; | |
if (form.$valid) { | |
this.Auth.login(user) | |
.then( | |
(data) => { | |
this.errors.login = data; | |
// Logged in, redirect to home | |
//this.$state.go('main'); | |
}, | |
(err) => { | |
this.errors.login = err; | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment