Skip to content

Commit

Permalink
Fix image is not showed by the alfresco file viewer because alf_ticke…
Browse files Browse the repository at this point in the history
…t is not added to the content url query params, pass ticketEcm to the alfrescoApi configuration used by alfrescoApiClient.ts getAlfTicket()
  • Loading branch information
alep85 committed Jul 18, 2023
1 parent 567eb57 commit efc5af7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
*/

import { AlfrescoApiConfig } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { StorageService } from '../../..';

export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
return () => angularAlfrescoApiService.init();
Expand All @@ -28,6 +29,8 @@ export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApi
providedIn: 'root'
})
export class AlfrescoApiLoaderService {
private readonly storageService = inject(StorageService);

constructor(private readonly appConfig: AppConfigService, private readonly apiService: AlfrescoApiService) {}

async init(): Promise<any> {
Expand All @@ -53,7 +56,8 @@ export class AlfrescoApiLoaderService {
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
withCredentials: this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
domainPrefix: this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX),
oauth2: oauth
oauth2: oauth,
...(this.storageService.getItem('ticket-ECM') && {ticketEcm: this.storageService.getItem('ticket-ECM')})
});

await this.apiService.load(config);
Expand Down

0 comments on commit efc5af7

Please sign in to comment.