Skip to content

Commit

Permalink
Padronizando mensagem
Browse files Browse the repository at this point in the history
  • Loading branch information
DaviMarinho committed Nov 14, 2023
1 parent 3c5992a commit ecd4502
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/pages/register/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/reset-password/reset-password.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
10 changes: 6 additions & 4 deletions src/app/pages/suggest-agenda/suggest-agenda.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -19,7 +20,8 @@ export class SuggestAgendaComponent implements OnInit {

constructor(
private fb: FormBuilder,
private emailService: EmailService
private emailService: EmailService,
private alertService: AlertService,
) { }

ngOnInit(): void {
Expand Down Expand Up @@ -49,16 +51,16 @@ export class SuggestAgendaComponent implements OnInit {
emailData.recipients = [emailUnB];
this.isSendingEmail = true;
this.emailService.sendEmail(emailData).subscribe((res: HttpResponse<string>) => {
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!");
}
}

Expand Down

0 comments on commit ecd4502

Please sign in to comment.