1
|
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
|
|
9
|
@Injectable()
|
10
|
export class EmailService {
|
11
|
|
12
|
constructor(private http:HttpClient) {
|
13
|
}
|
14
|
|
15
|
notifyForNewManagers(properties: EnvProperties, pid: string, email: Email) {
|
16
|
let body = JSON.stringify(email);
|
17
|
|
18
|
return this.http.post(properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + pid, body, CustomOptions.getAuthOptionsWithBody());
|
19
|
//.map(request => request.json());
|
20
|
}
|
21
|
|
22
|
sendEmail(properties: EnvProperties, email: Email) {
|
23
|
let body = JSON.stringify(email);
|
24
|
|
25
|
return this.http.post(properties.adminToolsAPIURL + "/sendMail/", body, CustomOptions.getAuthOptionsWithBody());
|
26
|
//.map(request => request.json());
|
27
|
}
|
28
|
|
29
|
contact(properties: EnvProperties, email: Email, recaptcha: string = null):Observable<boolean> {
|
30
|
const data: EmailRecaptcha = new EmailRecaptcha();
|
31
|
data.email = email;
|
32
|
data.recaptcha = recaptcha;
|
33
|
return this.http.post<boolean>(properties.adminToolsAPIURL + '/contact', data);
|
34
|
}
|
35
|
|
36
|
}
|