Last active
February 10, 2017 09:57
-
-
Save avatsaev/34b197e3138b1f3c007082c21d23df83 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
import {Component, OnInit, Output, EventEmitter} from '@angular/core'; | |
import {Angular2TokenService} from "angular2-token"; | |
@Component({ | |
selector: 'app-login-form', | |
templateUrl: './login-form.component.html', | |
styleUrls: ['./login-form.component.sass'] | |
}) | |
export class LoginFormComponent implements OnInit { | |
signInUser = { | |
email: '', | |
password: '' | |
}; | |
@Output() onFormResult = new EventEmitter<any>(); | |
constructor(private tokenAuthSerivce:Angular2TokenService) { } | |
ngOnInit() {} | |
onSignInSubmit(){ | |
this.tokenAuthSerivce.signIn(this.signInUser).subscribe( | |
res => { | |
if(res.status == 200){ | |
this.onFormResult.emit({signedIn: true, res}); | |
} | |
}, | |
err => { | |
console.log('err:', err); | |
this.onFormResult.emit({signedIn: false, err}); | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment