move ssh errors from common resource to auth keys service
[arvados.git] / src / services / common-service / common-resource-service.ts
index 0c99e7d4be10ce56c4b453e01448ad56254069fe..70c1df0e2bc5e665a3c62c05b39b7a50a6705c62 100644 (file)
@@ -62,7 +62,7 @@ export class CommonResourceService<T extends Resource> {
             }
         }
 
-    static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions): Promise<R> {
+    static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions, mapKeys = true): Promise<R> {
         const reqId = uuid();
         actions.progressFn(reqId, true);
         return promise
@@ -70,7 +70,9 @@ export class CommonResourceService<T extends Resource> {
                 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;