File tree 4 files changed +19
-13
lines changed
4 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ export class BaseAPI {
47
47
return params ;
48
48
}
49
49
50
+ public mapParams ( params ) {
51
+ return {
52
+ params : this . mapSort (
53
+ this . mapPageToOffset ? this . mapPageToOffset ( params ) : params ,
54
+ ) ,
55
+ } ;
56
+ }
57
+
50
58
// The api uses sort/ordering/order_by for sort
51
59
// the UI uses sort and maps to whatever the api expects
52
60
// (set sortParam)
@@ -60,11 +68,7 @@ export class BaseAPI {
60
68
}
61
69
62
70
list ( params ?: object , apiPath ?: string ) {
63
- return this . http . get ( this . getPath ( apiPath ) , {
64
- params : this . mapSort (
65
- this . mapPageToOffset ? this . mapPageToOffset ( params ) : params ,
66
- ) ,
67
- } ) ;
71
+ return this . http . get ( this . getPath ( apiPath ) , this . mapParams ( params ) ) ;
68
72
}
69
73
70
74
get ( id : string , apiPath ?: string ) {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export class API extends HubAPI {
33
33
getUsedDependenciesByCollection ( namespace , collection , params = { } ) {
34
34
return this . http . get (
35
35
this . apiPath + `?dependency=${ namespace } .${ collection } ` ,
36
- { params : this . mapPageToOffset ( params ) } ,
36
+ this . mapParams ( params ) ,
37
37
) ;
38
38
}
39
39
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ export class API extends HubAPI {
147
147
getUsedDependenciesByCollection ( namespace , collection , params = { } ) {
148
148
return this . http . get (
149
149
`_ui/v1/collection-versions/?dependency=${ namespace } .${ collection } ` ,
150
- { params : this . mapPageToOffset ( params ) } ,
150
+ this . mapParams ( params ) ,
151
151
) ;
152
152
}
153
153
Original file line number Diff line number Diff line change @@ -12,19 +12,21 @@ class API extends HubAPI {
12
12
}
13
13
14
14
images ( name , params ) {
15
- return this . http . get ( this . apiPath + `${ name } /_content/images/` , {
16
- params : this . mapPageToOffset ( params ) ,
17
- } ) ;
15
+ return this . http . get (
16
+ this . apiPath + `${ name } /_content/images/` ,
17
+ this . mapParams ( params ) ,
18
+ ) ;
18
19
}
19
20
20
21
image ( name , digest ) {
21
22
return this . http . get ( this . apiPath + `${ name } /_content/images/${ digest } /` ) ;
22
23
}
23
24
24
25
tags ( name , params ) {
25
- return this . http . get ( this . apiPath + `${ name } /_content/tags/` , {
26
- params : this . mapPageToOffset ( params ) ,
27
- } ) ;
26
+ return this . http . get (
27
+ this . apiPath + `${ name } /_content/tags/` ,
28
+ this . mapParams ( params ) ,
29
+ ) ;
28
30
}
29
31
30
32
deleteImage ( name , manifest ) {
You can’t perform that action at this time.
0 commit comments