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"; @Injectable() export class EmailService { constructor(private http:HttpClient) { } sendEmail(url: string, email: Email) { let body = JSON.stringify(email); return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()); //.map(request => request.json()); } contact(url: string, email: Email, recaptcha: string) { const data: EmailRecaptcha = new EmailRecaptcha(); data.email = email; data.recaptcha = recaptcha; return this.http.post(url, data); //.map(request => request.json()); } }