Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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']);
- }
- });
- }
Add Comment
Please, Sign In to add comment