[AAE-12501] Replace oauth2Auth with alfrescoApi

This commit is contained in:
Amedeo Lepore
2023-03-31 12:12:02 +02:00
parent 92fad7d0f3
commit 82ae9d53d1
2 changed files with 4 additions and 6 deletions
@@ -31,9 +31,7 @@ describe('AppsProcessCloudService', () => {
let apiService: AlfrescoApiService;
const apiMock: any = {
oauth2Auth: {
callCustomApi: () => Promise.resolve({list : { entries: [ {entry: fakeApplicationInstance[0]}, {entry: fakeApplicationInstance[1]}] }})
},
callCustomApiWithoutAuth: () => Promise.resolve({list : { entries: [ {entry: fakeApplicationInstance[0]}, {entry: fakeApplicationInstance[1]}] }}),
isEcmLoggedIn: () => false,
reply: jasmine.createSpy('reply')
};
@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
import { Observable, from, throwError, of } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core';
import { Oauth2Auth } from '@alfresco/js-api';
import { AlfrescoApi } from '@alfresco/js-api';
import { ApplicationInstanceModel } from '../models/application-instance.model';
@Injectable({ providedIn: 'root' })
@@ -62,7 +62,7 @@ export class AppsProcessCloudService {
if (status === '') {
return of([]);
}
const api: Oauth2Auth = this.apiService.getInstance().oauth2Auth;
const api: AlfrescoApi = this.apiService.getInstance();
const path = this.getApplicationUrl();
const pathParams = {};
const queryParams = { status, roles : role, sort: 'name' };
@@ -72,7 +72,7 @@ export class AppsProcessCloudService {
const contentTypes = ['application/json'];
const accepts = ['application/json'];
return from(api.callCustomApi(path, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
return from(api.callCustomApiWithoutAuth(path, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts))
.pipe(
map((applications: any) => applications.list.entries.map((application) => application.entry)),