diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/app.module.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/app.module.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts index ea73d382e2..970c57de89 100644 --- a/catalog-ui/src/app/ng2/app.module.ts +++ b/catalog-ui/src/app/ng2/app.module.ts @@ -11,13 +11,15 @@ import { StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider } from "./utils/ng1-upgraded-provider"; import {ConfigService} from "./services/config.service"; -import {HttpService} from "./services/http.service"; import {HttpModule} from '@angular/http'; import {AuthenticationService} from './services/authentication.service'; import {Cookie2Service} from "./services/cookie.service"; import {ComponentServiceNg2} from "./services/component-services/component.service"; import {ServiceServiceNg2} from "./services/component-services/service.service"; import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service"; +import { InterceptorService } from 'ng2-interceptors'; +import { XHRBackend, RequestOptions } from '@angular/http'; +import {HttpInterceptor} from "./services/http.interceptor.service"; export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); @@ -25,6 +27,13 @@ export function configServiceFactory(config:ConfigService) { return () => config.loadValidationConfiguration(); } +export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions){ + let service = new InterceptorService(xhrBackend, requestOptions); + service.addInterceptor(new HttpInterceptor()); + return service; +} + + // export function httpServiceFactory(backend: XHRBackend, options: RequestOptions) { // return new HttpService(backend, options); // } @@ -43,7 +52,6 @@ export function configServiceFactory(config:ConfigService) { exports: [], entryComponents: [], providers: [ - HttpService, DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, @@ -61,6 +69,11 @@ export function configServiceFactory(config:ConfigService) { useFactory: configServiceFactory, deps: [ConfigService], multi: true + }, + { + provide: InterceptorService, + useFactory: interceptorFactory, + deps: [XHRBackend, RequestOptions] } ], bootstrap: [AppComponent] |