1 |
61381
|
k.triantaf
|
import {Injectable} from '@angular/core';
|
2 |
|
|
import {HttpClient} from "@angular/common/http";
|
3 |
|
|
import {Email} from './email';
|
4 |
|
|
import {CustomOptions} from '../../services/servicesUtils/customOptions.class';
|
5 |
|
|
import {EmailRecaptcha} from "../entities/EmailRecaptcha";
|
6 |
|
|
import {Observable} from "rxjs";
|
7 |
|
|
import {EnvProperties} from "../properties/env-properties";
|
8 |
|
|
import {properties} from "../../../../environments/environment";
|
9 |
|
|
|
10 |
|
|
@Injectable()
|
11 |
|
|
export class EmailService {
|
12 |
|
|
|
13 |
|
|
constructor(private http:HttpClient) {
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
notifyManagers(pid: string, role: "manager" | "subscriber", email: Email) {
|
17 |
|
|
return this.http.post(properties.adminToolsAPIURL + '/notifyManagers/' + pid + '/' + role, email, CustomOptions.getAuthOptions())
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
notifyNewManager(email: Email) {
|
21 |
|
|
return this.http.post(properties.adminToolsAPIURL + '/notifyNewManager', email, CustomOptions.getAuthOptions())
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
sendEmail(properties: EnvProperties, email: Email) {
|
25 |
|
|
return this.http.post(properties.adminToolsAPIURL + "/sendMail/", email, CustomOptions.registryOptions());
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
contact(properties: EnvProperties, email: Email, recaptcha: string = null):Observable<boolean> {
|
29 |
|
|
const data: EmailRecaptcha = new EmailRecaptcha();
|
30 |
|
|
data.email = email;
|
31 |
|
|
data.recaptcha = recaptcha;
|
32 |
|
|
return this.http.post<boolean>(properties.adminToolsAPIURL + '/contact', data);
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
}
|