File tree 4 files changed +15
-7
lines changed
4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { Constants } from 'src/constants';
4
4
import { ParamHelper } from 'src/utilities' ;
5
5
6
6
export class BaseAPI {
7
- apiBase : string ; // API_BASE_PATH or PULP_API_BASE_PATH
8
7
apiPath : string ;
9
8
// eslint-disable-next-line @typescript-eslint/no-explicit-any
10
9
http : any ;
@@ -13,12 +12,12 @@ export class BaseAPI {
13
12
14
13
// a request URL is created from:
15
14
// * API_HOST - optional, for use with different hostname
16
- // * apiBase - set by HubAPI, LegacyAPI & PulpAPI
15
+ // * apiBaseUrl - api/pulp prefix, ends in trailing slash
17
16
// * apiPath - set by leaf API classes
18
17
// any extra id or params added by custom methods
19
- constructor ( ) {
18
+ constructor ( apiBaseUrl ) {
20
19
this . http = axios . create ( {
21
- baseURL : API_HOST + this . apiBase ,
20
+ baseURL : API_HOST + apiBaseUrl ,
22
21
paramsSerializer : {
23
22
serialize : ( params ) => ParamHelper . getQueryString ( params ) ,
24
23
} ,
Original file line number Diff line number Diff line change 1
1
import { BaseAPI } from './base' ;
2
2
3
3
export class HubAPI extends BaseAPI {
4
- apiBase = API_BASE_PATH ;
5
4
mapPageToOffset = true ; // offset & limit
6
5
sortParam = 'sort' ;
6
+
7
+ constructor ( ) {
8
+ super ( API_BASE_PATH ) ;
9
+ }
7
10
}
Original file line number Diff line number Diff line change 1
1
import { BaseAPI } from './base' ;
2
2
3
3
export class LegacyAPI extends BaseAPI {
4
- apiBase = API_BASE_PATH ;
5
4
mapPageToOffset = false ; // page & page_size
6
5
sortParam = 'order_by' ;
6
+
7
+ constructor ( ) {
8
+ super ( API_BASE_PATH ) ;
9
+ }
7
10
}
Original file line number Diff line number Diff line change 1
1
import { BaseAPI } from './base' ;
2
2
3
3
export class PulpAPI extends BaseAPI {
4
- apiBase = PULP_API_BASE_PATH ;
5
4
mapPageToOffset = true ; // offset & limit
6
5
sortParam = 'ordering' ;
6
+
7
+ constructor ( ) {
8
+ super ( PULP_API_BASE_PATH ) ;
9
+ }
7
10
}
You can’t perform that action at this time.
0 commit comments