Last active
May 21, 2017 11:20
-
-
Save avatsaev/9cb1e0ac71b1bf1d795d45ad57059de5 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 {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