[ACS-6227] cleanup error handling and fix typing issues (#9035)

* cleanup audit service, remove useless ajax tests

* cleanup sites service and remove useless ajax tests

* cleanup services

* cleanup services

* fix typings

* code cleanup
This commit is contained in:
Denys Vuika
2023-10-27 13:51:28 +01:00
committed by GitHub
parent 53ad9f729b
commit 2d3175ef4a
24 changed files with 319 additions and 937 deletions

View File

@@ -18,14 +18,12 @@
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import { Injectable } from '@angular/core';
import { throwError } from 'rxjs';
import { ActivitiContentApi } from '@alfresco/js-api';
import { ActivitiContentApi, RelatedContentRepresentation } from '@alfresco/js-api';
@Injectable({
providedIn: 'root'
})
export class TaskUploadService extends UploadService {
private _contentApi: ActivitiContentApi;
get contentApi(): ActivitiContentApi {
this._contentApi = this._contentApi ?? new ActivitiContentApi(this.apiService.getInstance());
@@ -36,20 +34,11 @@ export class TaskUploadService extends UploadService {
super(apiService, appConfigService, discoveryApiService);
}
getUploadPromise(file: any): any {
getUploadPromise(file: any): Promise<RelatedContentRepresentation> {
const opts = {
isRelatedContent: true
};
const taskId = file.options.parentId;
const promise = this.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
promise.catch((err) => this.handleError(err));
return promise;
return this.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
}
private handleError(error: any) {
return throwError(error || 'Server error');
}
}