|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { Component, EventEmitter, Output, ViewChild } from '@angular/core';
|
|
|
|
|
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
|
|
|
|
|
|
|
|
|
|
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
|
|
|
|
|
|
|
@ -31,7 +31,7 @@ import { Router } from '@angular/router';
|
|
|
|
|
styleUrl: './login.component.css'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export class LoginComponent {
|
|
|
|
|
export class LoginComponent implements OnInit {
|
|
|
|
|
@Output() addConnectEvent = new EventEmitter<User>();
|
|
|
|
|
|
|
|
|
|
public isButtonVisible = false;
|
|
|
|
@ -47,11 +47,11 @@ export class LoginComponent {
|
|
|
|
|
this.UserService = us
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
sessionStorage.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect() {
|
|
|
|
|
console.log(this.loginForm.value.login)
|
|
|
|
|
console.log(this.loginForm.value.password)
|
|
|
|
|
|
|
|
|
|
if (this.loginForm.invalid) {
|
|
|
|
|
console.log("ERREUR INVALIDE");
|
|
|
|
|
return;
|
|
|
|
@ -61,9 +61,11 @@ export class LoginComponent {
|
|
|
|
|
console.log("ERREUR DIFFERENT");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log(this.loginForm.value.login)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.user = this.loginForm.value;
|
|
|
|
|
localStorage.setItem('UserConnecte',String(this.user.id));
|
|
|
|
|
localStorage.setItem('UserConnecte',String(this.user.login));
|
|
|
|
|
|
|
|
|
|
//this.UserService.addUserToLocal(this.user);
|
|
|
|
|
this.addConnectEvent.emit(this.user);
|
|
|
|
|