Commit 3effadcc authored by Janik Münzenberger's avatar Janik Münzenberger
Browse files

Add error display

parent a2207644
<div class="alert alert-success" *ngIf="sent" role="alert"><i class="fas fa-check"></i>{{"EMAIL.SUCCESS" | translate}}</div>
<div class="alert alert-success" *ngIf="sent" role="alert"><i class="fas fa-check mr-2"></i>{{"EMAIL.SUCCESS" | translate}}</div>
<div class="alert alert-danger" *ngIf="!sent && error" role="alert">{{"EMAIL.FAILED" | translate}}</div>
<form [formGroup]="emailForm" *ngIf="!sent">
<div class="form-group row">
<label for="email_sender" class="col-sm-2 col-form-label">{{"EMAIL.SENDER" | translate}}:</label>
......
......@@ -16,6 +16,7 @@ export class EmailComponent implements OnInit {
@Input() message: string = "";
emailForm: FormGroup;
sent: boolean = false;
error: boolean = false;
constructor(private emailService: EmailService,
private userService: UserService) { }
......@@ -37,12 +38,15 @@ export class EmailComponent implements OnInit {
let email: IEmail = {
sender: this.emailForm.get('email_sender').value,
receiver: this.emailForm.get('email_receiver').value,
subject: "Email von PSE HDA app",
subject: "Krankheitsanalyse von " + this.emailForm.get('email_sender').value,
message: this.emailForm.get('email_message').value + "\n\n" + this.message
};
this.emailService.sendEmail(email)
.then(x => this.sent = true)
.catch(err => console.log(err));
.catch(err => {
console.log(err);
this.error = true;
});
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment