import {Injectable} from '@angular/core'; import {Http, Response, Headers, RequestOptions} from '@angular/http'; 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 { const data: EmailRecaptcha = new EmailRecaptcha(); data.email = email; data.recaptcha = recaptcha; return this.http.post(properties.adminToolsAPIURL + '/contact', data); } }