Apply fixes according to code review comments
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Mon, 2 Jul 2018 14:16:10 +0000 (16:16 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Mon, 2 Jul 2018 14:16:10 +0000 (16:16 +0200)
Feature #13702

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/common/api/common-resource-service.ts
src/services/groups-service/groups-service.ts

index e49d2a0b2dfb1b865496ed3ff9acc70727ad1a4d..93fc000e19cf2d1edb8ad9057dd70d6dc1f52f68 100644 (file)
@@ -39,9 +39,6 @@ export interface ListResults<T> {
 
 export default class CommonResourceService<T extends Resource> {
 
-    serverApi: AxiosInstance;
-    resourceType: string;
-
     static mapResponseKeys = (response: any): Promise<any> =>
         CommonResourceService.mapKeys(_.camelCase)(response.data)
 
@@ -63,9 +60,12 @@ export default class CommonResourceService<T extends Resource> {
             }
         }
 
+    protected serverApi: AxiosInstance;
+    protected resourceType: string;
+
     constructor(serverApi: AxiosInstance, resourceType: string) {
         this.serverApi = serverApi;
-        this.resourceType = "/" + resourceType;
+        this.resourceType = '/' + resourceType + '/';
     }
 
     create() {
@@ -74,13 +74,13 @@ export default class CommonResourceService<T extends Resource> {
 
     delete(uuid: string): Promise<T> {
         return this.serverApi
-            .delete(this.resourceType + "/" + uuid)
+            .delete(this.resourceType + uuid)
             .then(CommonResourceService.mapResponseKeys);
     }
 
     get(uuid: string) {
         return this.serverApi
-            .get<T>(this.resourceType + "/" + uuid)
+            .get<T>(this.resourceType + uuid)
             .then(CommonResourceService.mapResponseKeys);
     }
 
index 9016714b93de519804a9b4cfbee42d6c151de68b..f230c70fa0bdd94ca3867f283fd2e7babe9303e2 100644 (file)
@@ -41,7 +41,7 @@ export default class GroupsService extends CommonResourceService<GroupResource>
             order: order ? order.get() : undefined
         };
         return this.serverApi
-            .get(this.resourceType + `/${uuid}/contents`, {
+            .get(this.resourceType + `${uuid}/contents/`, {
                 params: CommonResourceService.mapKeys(_.snakeCase)(params)
             })
             .then(CommonResourceService.mapResponseKeys);