mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-10501] Remove config from a CoreModule, a different service is provided in AuthModule to use angular http client instead of super agent
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiHttpClient } from '@alfresco/adf-core/api';
|
||||
import { StorageService } from '../common/services/storage.service';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService } from '../app-config';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoApiServiceWithAngularBasedHttpClient extends AlfrescoApiService {
|
||||
constructor(
|
||||
storage: StorageService,
|
||||
appConfig: AppConfigService,
|
||||
private readonly alfrescoApiHttpClient: AlfrescoApiHttpClient
|
||||
) {
|
||||
super(appConfig, storage);
|
||||
}
|
||||
|
||||
override createInstance(config: AlfrescoApiConfig) {
|
||||
return new AlfrescoApi(config, this.alfrescoApiHttpClient);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,6 @@ import { BlankPageModule } from './blank-page/blank-page.module';
|
||||
import { DirectiveModule } from './directives/directive.module';
|
||||
import { PipeModule } from './pipes/pipe.module';
|
||||
|
||||
import { AlfrescoApiService } from './services/alfresco-api.service';
|
||||
import { TranslationService } from './translation/translation.service';
|
||||
import { SortingPickerModule } from './sorting-picker/sorting-picker.module';
|
||||
import { IconModule } from './icon/icon.module';
|
||||
@@ -66,13 +65,6 @@ import { loadAppConfig } from './app-config/app-config.loader';
|
||||
import { AppConfigService } from './app-config/app-config.service';
|
||||
import { StorageService } from './common/services/storage.service';
|
||||
import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-factories/alfresco-api-v2-loader.service';
|
||||
import { AlfrescoApiServiceWithAngularBasedHttpClient } from './api-factories/alfresco-api-service-with-angular-based-http-client';
|
||||
|
||||
interface Config {
|
||||
readonly useAngularBasedHttpClientInAlfrescoJs: boolean;
|
||||
}
|
||||
|
||||
const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false };
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -150,7 +142,7 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false };
|
||||
]
|
||||
})
|
||||
export class CoreModule {
|
||||
static forRoot(config: Config = defaultConfig): ModuleWithProviders<CoreModule> {
|
||||
static forRoot(): ModuleWithProviders<CoreModule> {
|
||||
return {
|
||||
ngModule: CoreModule,
|
||||
providers: [
|
||||
@@ -182,11 +174,7 @@ export class CoreModule {
|
||||
deps: [ AlfrescoApiLoaderService ],
|
||||
multi: true
|
||||
},
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: AuthBearerInterceptor, multi: true },
|
||||
...(config.useAngularBasedHttpClientInAlfrescoJs
|
||||
? [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceWithAngularBasedHttpClient }]
|
||||
: []
|
||||
)
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: AuthBearerInterceptor, multi: true }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user