Select Git revision
errorlogin.component.ts
Forked from an inaccessible project.
errorlogin.component.ts 1.27 KiB
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ErrorLogin, LoginService} from "../login.service";
@Component({
selector: 'app-errorlogin',
templateUrl: './errorlogin.component.html',
styleUrls: ['./errorlogin.component.css']
})
export class ErrorloginComponent implements OnInit, AfterViewInit{
@ViewChild('errorText', { static: true }) errorText!: ElementRef;
actualError!: ErrorLogin;
constructor(private loginService: LoginService) {
}
ngOnInit() {
this.actualError=this.loginService.actualError;
}
ngAfterViewInit() {
if(this.actualError === ErrorLogin.PassConfirm){
this.errorText.nativeElement.textContent="Les mots de passes doivent être identiques"
}
if(this.actualError === ErrorLogin.UserPassword){
this.errorText.nativeElement.textContent="Le mot de passe que vous avez saisi est incorrect, veuillez réessayer"
}
if(this.actualError === ErrorLogin.UserNotExist){
this.errorText.nativeElement.textContent="Le nom d'utilisateur que vous avez saisi n'existe pas"
}
if(this.actualError === ErrorLogin.UserNameExist){
this.errorText.nativeElement.textContent="Le nom d'utilisateur que vous avez saisi existe déjà, veuillez en choisir un autre"
}
}
}