From ecd4502faa5a3cd59302c0de625c3937c48638d1 Mon Sep 17 00:00:00 2001 From: DaviMarinho Date: Tue, 14 Nov 2023 15:35:40 -0300 Subject: [PATCH] Padronizando mensagem --- src/app/pages/register/register.component.ts | 2 +- .../pages/reset-password/reset-password.component.ts | 2 +- .../pages/suggest-agenda/suggest-agenda.component.ts | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/pages/register/register.component.ts b/src/app/pages/register/register.component.ts index 149ed2d5..4c7eb7c1 100644 --- a/src/app/pages/register/register.component.ts +++ b/src/app/pages/register/register.component.ts @@ -40,7 +40,7 @@ export class RegisterComponent implements OnInit { this.authService.registerUser(this.userForm.value).subscribe({ next: (data) => { console.log(data); - alert('Usuário cadastrado com sucesso!'); + this.alertService.showMessage("success", "Sucesso", "Usuário cadastrado com sucesso!"); this.navigator('/activeAccount'); }, error: (error) => { diff --git a/src/app/pages/reset-password/reset-password.component.ts b/src/app/pages/reset-password/reset-password.component.ts index c2c5741d..39f24537 100644 --- a/src/app/pages/reset-password/reset-password.component.ts +++ b/src/app/pages/reset-password/reset-password.component.ts @@ -38,7 +38,7 @@ export class ResetPasswordComponent implements OnInit { if (this.userForm.valid) { this.authService.updatePassword(this.userForm.value).subscribe({ next: (data) => { - alert('Senha alterada com sucesso!'); + this.alertService.showMessage("success", "Sucesso", "Senha alterada com sucesso!"); this.navigator('/login'); }, error: (error) => { diff --git a/src/app/pages/suggest-agenda/suggest-agenda.component.ts b/src/app/pages/suggest-agenda/suggest-agenda.component.ts index c1121ffd..4a05a7e7 100644 --- a/src/app/pages/suggest-agenda/suggest-agenda.component.ts +++ b/src/app/pages/suggest-agenda/suggest-agenda.component.ts @@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { EmailService } from 'src/app/services/email.service'; import { EmailData } from 'src/shared/model/email.model'; import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; +import { AlertService } from 'src/app/services/alert.service'; @Component({ selector: 'app-suggest-agenda', @@ -19,7 +20,8 @@ export class SuggestAgendaComponent implements OnInit { constructor( private fb: FormBuilder, - private emailService: EmailService + private emailService: EmailService, + private alertService: AlertService, ) { } ngOnInit(): void { @@ -49,16 +51,16 @@ export class SuggestAgendaComponent implements OnInit { emailData.recipients = [emailUnB]; this.isSendingEmail = true; this.emailService.sendEmail(emailData).subscribe((res: HttpResponse) => { - alert('Sugestão enviada com sucesso'); + this.alertService.showMessage("success", "Sucesso", "Sugestão enviada com sucesso"); }, (error: HttpErrorResponse) => { - alert('error: ' + error.message); + this.alertService.showMessage("error", "Erro", 'error: ' + error.message); }, () => { this.isSendingEmail = false; }); } else { - this.alertService.showMessage("info", "Alerta", "Preencha todos os campos corretamente!"); os campos obrigatórios!'); + this.alertService.showMessage("info", "Alerta", "Preencha todos os campos corretamente!"); } }