X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a4e2c41eb689b86b04a88ea2971282ce14de2b88..13bf073c77ca9fcf75ebd31098a9bf538e96c9c9:/src/services/common-service/common-resource-service.ts diff --git a/src/services/common-service/common-resource-service.ts b/src/services/common-service/common-resource-service.ts index 90677b05b6..70c1df0e2b 100644 --- a/src/services/common-service/common-resource-service.ts +++ b/src/services/common-service/common-resource-service.ts @@ -62,7 +62,7 @@ export class CommonResourceService { } } - static defaultResponse(promise: AxiosPromise, actions: ApiActions): Promise { + static defaultResponse(promise: AxiosPromise, actions: ApiActions, mapKeys = true): Promise { const reqId = uuid(); actions.progressFn(reqId, true); return promise @@ -70,7 +70,9 @@ export class CommonResourceService { actions.progressFn(reqId, false); return data; }) - .then(CommonResourceService.mapResponseKeys) + .then((response: { data: any }) => { + return mapKeys ? CommonResourceService.mapResponseKeys(response) : response.data; + }) .catch(({ response }) => { actions.progressFn(reqId, false); const errors = CommonResourceService.mapResponseKeys(response) as Errors; @@ -79,18 +81,6 @@ export class CommonResourceService { }); } - static customResponse(promise: AxiosPromise, actions: ApiActions): Promise { - const reqId = uuid(); - actions.progressFn(reqId, true); - return promise - .then(data => { - actions.progressFn(reqId, false); - return data; - }) - .then((response: { data: any }) => response.data); - } - - protected serverApi: AxiosInstance; protected resourceType: string; protected actions: ApiActions;