mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[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:
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user