-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathLoaders.ts
More file actions
28 lines (21 loc) · 812 Bytes
/
Loaders.ts
File metadata and controls
28 lines (21 loc) · 812 Bytes
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
import { HttpClient } from '@angular/common/http';
import { stripTrailingSlash } from './utils';
export abstract class WpApiLoader {
abstract getWebServiceUrl(postfix: string): string;
}
/******************************************************************************
* Class: WpApiStaticLoader
******************************************************************************/
export class WpApiStaticLoader implements WpApiLoader {
completeUrl: string;
constructor(
private http: HttpClient,
private baseUrl: string = 'http://changeYourDomainHere.com/wp-json',
private namespace: string = '/wp/v2'
) {
this.completeUrl = `${stripTrailingSlash(this.baseUrl)}${this.namespace}`;
}
public getWebServiceUrl(postfix: string): string {
return `${this.completeUrl}${postfix}`
}
}