37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {HttpClient} from "@angular/common/http";
|
|
import {Email} from './email';
|
|
import {CustomOptions} from '../../services/servicesUtils/customOptions.class';
|
|
import {EmailRecaptcha} from "../entities/EmailRecaptcha";
|
|
import {Observable} from "rxjs";
|
|
import {EnvProperties} from "../properties/env-properties";
|
|
|
|
@Injectable()
|
|
export class EmailService {
|
|
|
|
constructor(private http:HttpClient) {
|
|
}
|
|
|
|
notifyForNewManagers(properties: EnvProperties, pid: string, email: Email) {
|
|
let body = JSON.stringify(email);
|
|
|
|
return this.http.post(properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + pid, body, CustomOptions.getAuthOptionsWithBody());
|
|
//.map(request => request.json());
|
|
}
|
|
|
|
sendEmail(properties: EnvProperties, email: Email) {
|
|
let body = JSON.stringify(email);
|
|
|
|
return this.http.post(properties.adminToolsAPIURL + "/sendMail/", body, CustomOptions.getAuthOptionsWithBody());
|
|
//.map(request => request.json());
|
|
}
|
|
|
|
contact(properties: EnvProperties, email: Email, recaptcha: string = null):Observable<boolean> {
|
|
const data: EmailRecaptcha = new EmailRecaptcha();
|
|
data.email = email;
|
|
data.recaptcha = recaptcha;
|
|
return this.http.post<boolean>(properties.adminToolsAPIURL + '/contact', data);
|
|
}
|
|
|
|
}
|