-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathParent.ts
More file actions
36 lines (32 loc) · 1.26 KB
/
Parent.ts
File metadata and controls
36 lines (32 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { IParent } from './interfaces';
import { WpApiLoader } from './Loaders';
/******************************************************************************
* Service: WpApiParent
******************************************************************************/
@Injectable()
export class WpApiParent implements IParent {
constructor(
public wpApiLoader: WpApiLoader,
public http: HttpClient
) { }
httpGet(url: string, options = {}) {
return this.http.get(this.wpApiLoader.getWebServiceUrl(url), options);
}
httpHead(url: string, options = {}) {
return this.http.head(this.wpApiLoader.getWebServiceUrl(url), options);
}
httpDelete(url: string, options = {}) {
return this.http.delete(this.wpApiLoader.getWebServiceUrl(url), options);
}
httpPost(url: string, body = {}, options = {}) {
return this.http.post(this.wpApiLoader.getWebServiceUrl(url), body, options);
}
httpPut(url: string, body = {}, options = {}) {
return this.http.put(this.wpApiLoader.getWebServiceUrl(url), body, options);
}
httpPatch(url: string, body = {}, options = {}) {
return this.http.patch(this.wpApiLoader.getWebServiceUrl(url), body, options);
}
}