X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59ee572e791985a36bdd2015c9b494145109e8ed..f6093a73debdd7135870582088202da459386f17:/src/services/common-service/trashable-resource-service.ts diff --git a/src/services/common-service/trashable-resource-service.ts b/src/services/common-service/trashable-resource-service.ts index 23e7366e..63be3ab8 100644 --- a/src/services/common-service/trashable-resource-service.ts +++ b/src/services/common-service/trashable-resource-service.ts @@ -6,27 +6,32 @@ import * as _ from "lodash"; import { AxiosInstance } from "axios"; import { TrashableResource } from "src/models/resource"; import { CommonResourceService } from "~/services/common-service/common-resource-service"; +import { ApiActions } from "~/services/api/api-actions"; export class TrashableResourceService extends CommonResourceService { - constructor(serverApi: AxiosInstance, resourceType: string) { - super(serverApi, resourceType); + constructor(serverApi: AxiosInstance, resourceType: string, actions: ApiActions, readOnlyFields: string[] = []) { + super(serverApi, resourceType, actions, readOnlyFields); } trash(uuid: string): Promise { - return this.serverApi - .post(this.resourceType + `${uuid}/trash`) - .then(CommonResourceService.mapResponseKeys); + return CommonResourceService.defaultResponse( + this.serverApi + .post(this.resourceType + `/${uuid}/trash`), + this.actions + ); } untrash(uuid: string): Promise { const params = { ensure_unique_name: true }; - return this.serverApi - .post(this.resourceType + `${uuid}/untrash`, { - params: CommonResourceService.mapKeys(_.snakeCase)(params) - }) - .then(CommonResourceService.mapResponseKeys); + return CommonResourceService.defaultResponse( + this.serverApi + .post(this.resourceType + `/${uuid}/untrash`, { + params: CommonResourceService.mapKeys(_.snakeCase)(params) + }), + this.actions + ); } }