Revision 53743
Added by Sofia Baltzi almost 6 years ago
email.service.ts | ||
---|---|---|
1 | 1 |
import {Injectable} from '@angular/core'; |
2 | 2 |
import {Http, Response, Headers, RequestOptions} from '@angular/http'; |
3 | 3 |
import {Email} from './email'; |
4 |
import {CustomOptions} from '../../services/servicesUtils/customOptions.class'; |
|
4 | 5 |
|
5 | 6 |
@Injectable() |
6 | 7 |
export class EmailService { |
... | ... | |
9 | 10 |
} |
10 | 11 |
|
11 | 12 |
sendEmail(url: string, email: Email) { |
12 |
let headers = new Headers({'Content-Type': 'application/json'}); |
|
13 |
let options = new RequestOptions({headers: headers}); |
|
14 | 13 |
let body = JSON.stringify(email); |
15 |
|
|
16 | 14 |
console.log(body); |
17 | 15 |
|
18 |
return this.http.post(url, body, options)
|
|
16 |
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
|
|
19 | 17 |
.do(request => console.log("Insert Response:"+request.status)); |
20 | 18 |
} |
21 | 19 |
|
Also available in: Unified diff
Change email headers