Add loading in sending

This commit is contained in:
Konstantinos Triantafyllou 2023-11-29 09:50:53 +02:00
parent 512ff36815
commit a97c39ec96
1 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import {FullScreenModalComponent} from "../openaireLibrary/utils/modal/full-scre
import {EmailService} from "../openaireLibrary/utils/email/email.service";
import {Email} from "../openaireLibrary/utils/email/email";
import {properties} from "../../environments/environment";
import {error} from "@angular/compiler-cli/src/transformers/util";
@Component({
selector: 'admin',
@ -356,6 +357,7 @@ export class AdminComponent implements OnInit, OnDestroy{
}
sendEmail() {
this.loading = true;
let email = new Email();
email.body = this.emailForm.get('body').value;
email.subject = this.emailForm.get('subject').value;
@ -366,6 +368,10 @@ export class AdminComponent implements OnInit, OnDestroy{
} else {
NotificationHandler.rise('An error has occurred. Please try again later!', 'danger');
}
this.loading = false;
}, error => {
NotificationHandler.rise('An error has occurred. Please try again later!', 'danger');
this.loading = false;
})
}
}