This commit is contained in:
Sébastien André
2020-03-14 23:10:21 +01:00
parent 0e3fdd8f54
commit 8427691db4
4 changed files with 55 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { first } from "rxjs/operators";
import { AuthenticationService } from "../../services/authentication.service";
import { User } from "../../models/user";
@Component({
selector: "app-login",
@@ -50,7 +51,7 @@ export class LoginComponent implements OnInit {
}
get createCtrls() {
return this.loginForm.controls;
return this.createForm.controls;
}
onLoginSubmit() {
@@ -85,8 +86,12 @@ export class LoginComponent implements OnInit {
}
this.loading = true;
let createUser = new User();
createUser.login = this.createCtrls.username.value;
createUser.password = this.createCtrls.password.value;
this.authenticationService
.login(this.createCtrls.username.value, this.createCtrls.password.value)
.create(createUser)
.pipe(first())
.subscribe(
data => {