amélioration du style

This commit is contained in:
MiharyR 2021-11-01 11:59:20 +01:00
parent 7ebacdc287
commit 4336169d2e
72 changed files with 2172 additions and 529 deletions

View file

@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {MessageService} from "../../utils/services/message/message.service";
import {Router} from "@angular/router";
import {ThemeService} from "../../utils/services/theme/theme.service";
@Component({
selector: 'app-page-connexion',
templateUrl: './page-connexion.component.html',
@ -11,8 +12,11 @@ import {ThemeService} from "../../utils/services/theme/theme.service";
})
export class PageConnexionComponent implements OnInit
{
email: string = ""
password: string = ""
pseudo: string = "" ;
password: string = "" ;
hasError: boolean = false;
errorMessage: string = "";
constructor( private messageService: MessageService,
private router: Router,
@ -24,22 +28,48 @@ export class PageConnexionComponent implements OnInit
onSeConnecter(): void
{
let data = {
"email": this.email,
"password": this.password
};
this.messageService
.sendMessage('connexion', data)
.subscribe( retour => this.maCallback(retour))
this.checkError();
if(!this.hasError)
{
let data = {
"pseudo": this.pseudo,
"password": this.password
};
this.messageService
.sendMessage('connexion', data)
.subscribe( retour => this.maCallback(retour))
}
}
maCallback(retour): void
{
if(retour.status === "error") console.log(retour.data)
console.log(retour.data)
if(retour.status === "error") {
this.errorMessage = retour.data.reason;
this.hasError = true;
}
else {
console.log(retour.data)
//this.router.navigateByUrl( '/search' );
}
}
checkError(): void
{
if(this.pseudo === "") {
this.errorMessage = "Veuillez remplir le champ login" ;
this.hasError = true;
}
else if(this.password === "") {
this.errorMessage = "Veuillez remplir le champ mot de passe" ;
this.hasError = true;
}
else {
this.errorMessage = "" ;
this.hasError = false;
}
}
}