Last active
January 20, 2018 22:13
-
-
Save dasmido/c1ee6d92f6bf21e263211f7b592e1fb2 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
onLoginSubmit(){ | |
//console.log(this.username); | |
const user = { | |
username: this.username, | |
password: this.password | |
} | |
this.authService.authenticateUser(user).subscribe(data => { | |
//console.log(data); | |
if(data.success){ | |
this.authService.storeUserData(data.token, data.user); | |
this.flashMessage.show('You are now logged in', { | |
cssClass: 'alert-success', | |
timeout: 5000}); | |
this.router.navigate(['dashboard']); | |
}else{ | |
this.flashMessage.show(data.msg, { | |
cssClass: 'alert-danger', | |
timeout: 5000}); | |
this.router.navigate(['login']); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment