X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d3f17ba544b22ae76f47401041362bbcefe95aaa..c63ba4011d124c9efee4e4f1cd6568d4eb8a8d23:/src/common/api/common-resource-service.ts diff --git a/src/common/api/common-resource-service.ts b/src/common/api/common-resource-service.ts index e49d2a0b..93fc000e 100644 --- a/src/common/api/common-resource-service.ts +++ b/src/common/api/common-resource-service.ts @@ -39,9 +39,6 @@ export interface ListResults { export default class CommonResourceService { - serverApi: AxiosInstance; - resourceType: string; - static mapResponseKeys = (response: any): Promise => CommonResourceService.mapKeys(_.camelCase)(response.data) @@ -63,9 +60,12 @@ export default class CommonResourceService { } } + 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 { delete(uuid: string): Promise { return this.serverApi - .delete(this.resourceType + "/" + uuid) + .delete(this.resourceType + uuid) .then(CommonResourceService.mapResponseKeys); } get(uuid: string) { return this.serverApi - .get(this.resourceType + "/" + uuid) + .get(this.resourceType + uuid) .then(CommonResourceService.mapResponseKeys); }