Revision 55964
Added by Argiro Kokogiannaki almost 5 years ago
email.service.ts | ||
---|---|---|
1 | 1 |
import {Injectable} from '@angular/core'; |
2 | 2 |
import {Http, Response, Headers, RequestOptions} from '@angular/http'; |
3 |
import {HttpClient} from "@angular/common/http"; |
|
3 | 4 |
import {Email} from './email'; |
4 | 5 |
import {CustomOptions} from '../../services/servicesUtils/customOptions.class'; |
5 | 6 |
import {EmailRecaptcha} from "../entities/EmailRecaptcha"; |
... | ... | |
7 | 8 |
@Injectable() |
8 | 9 |
export class EmailService { |
9 | 10 |
|
10 |
constructor(private http:Http) { |
|
11 |
constructor(private http:HttpClient) {
|
|
11 | 12 |
} |
12 | 13 |
|
13 | 14 |
sendEmail(url: string, email: Email) { |
14 | 15 |
let body = JSON.stringify(email); |
15 | 16 |
|
16 |
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()) |
|
17 |
.map(request => request.json()); |
|
17 |
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody());
|
|
18 |
//.map(request => request.json());
|
|
18 | 19 |
} |
19 | 20 |
|
20 | 21 |
contact(url: string, email: Email, recaptcha: string) { |
21 | 22 |
const data: EmailRecaptcha = new EmailRecaptcha(); |
22 | 23 |
data.email = email; |
23 | 24 |
data.recaptcha = recaptcha; |
24 |
return this.http.post(url, data) |
|
25 |
.map(request => request.json()); |
|
25 |
return this.http.post(url, data);
|
|
26 |
//.map(request => request.json());
|
|
26 | 27 |
} |
27 | 28 |
|
28 | 29 |
} |
Also available in: Unified diff
[Library|Trunk]
Merge into trunk branch angular7 rev 55729