mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-24 14:31:41 +00:00
Fix prefix is undefined
This commit is contained in:
@@ -20,8 +20,9 @@ import { StorageService } from '../common/services/storage.service';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
export function loadAppConfig(appConfigService: AppConfigService, storageService: StorageService, adfHttpClient: AdfHttpClient) {
|
||||
return () => appConfigService.load().then(() => {
|
||||
const init = () => {
|
||||
adfHttpClient.disableCsrf = appConfigService.get<boolean>(AppConfigValues.DISABLECSRF, true);
|
||||
storageService.prefix = appConfigService.get<string>(AppConfigValues.STORAGE_PREFIX, '');
|
||||
});
|
||||
}
|
||||
};
|
||||
return () => appConfigService.load(init);
|
||||
};
|
||||
|
@@ -189,7 +189,7 @@ export class AppConfigService {
|
||||
*
|
||||
* @returns Notification when loading is complete
|
||||
*/
|
||||
load(): Promise<any> {
|
||||
load(callback?: (...args: any[]) => any): Promise<any> {
|
||||
return new Promise(async (resolve) => {
|
||||
const configUrl = `app.config.json?v=${Date.now()}`;
|
||||
|
||||
@@ -198,6 +198,7 @@ export class AppConfigService {
|
||||
this.http.get(configUrl).subscribe(
|
||||
(data: any) => {
|
||||
this.status = Status.LOADED;
|
||||
callback?.();
|
||||
resolve(data);
|
||||
this.onDataLoaded(data);
|
||||
},
|
||||
|
@@ -15,18 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service';
|
||||
import { Authentication } from '../interfaces/authentication.interface';
|
||||
import { CookieService } from '../../common/services/cookie.service';
|
||||
import { ContentAuth } from './content-auth';
|
||||
import { ProcessAuth } from './process-auth';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { from, Observable, zip } from 'rxjs';
|
||||
import { RedirectionModel } from '../models/redirection.model';
|
||||
import { BaseAuthenticationService } from '../services/base-authentication.service';
|
||||
import { LogService } from '../../common';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { AlfrescoApiService } from '../../../..';
|
||||
|
||||
const REMEMBER_ME_COOKIE_KEY = 'ALFRESCO_REMEMBER_ME';
|
||||
const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30;
|
||||
@@ -35,6 +36,7 @@ const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30;
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
||||
alfrescoApiService = inject(AlfrescoApiService);
|
||||
|
||||
protected redirectUrl: RedirectionModel = null;
|
||||
|
||||
@@ -54,11 +56,12 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
||||
) {
|
||||
super(appConfig, cookie, logService);
|
||||
|
||||
this.appConfig.onLoad.subscribe(() => {
|
||||
if (this.isLoggedIn()) {
|
||||
this.onLogin.next('logged-in');
|
||||
}
|
||||
});
|
||||
zip(this.alfrescoApiService.alfrescoApiInitialized, this.appConfig.onLoad)
|
||||
.subscribe(() => {
|
||||
if (this.isLoggedIn()) {
|
||||
this.onLogin.next('logged-in');
|
||||
}
|
||||
});
|
||||
|
||||
this.contentAuth.onLogout.pipe(map((event) => {
|
||||
this.onLogout.next(event);
|
||||
|
Reference in New Issue
Block a user