Skip to content

Instantly share code, notes, and snippets.

@avatsaev
Last active May 21, 2017 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avatsaev/9cb1e0ac71b1bf1d795d45ad57059de5 to your computer and use it in GitHub Desktop.
Save avatsaev/9cb1e0ac71b1bf1d795d45ad57059de5 to your computer and use it in GitHub Desktop.
import {Component, OnInit, Output, EventEmitter} from '@angular/core';
import {AuthService} from "../services/auth.service";
@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(public authService:AuthService) {}
ngOnInit() {}
onSignInSubmit(){
this.authService.logInUser(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