[Trunk | Connect]: Use HttpInterceptorService (http-interceptor.service.ts) for not repeating in client requests of server.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@57202 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-09-30 11:43:24 +00:00
parent 345557a9b3
commit 4558e11745
2 changed files with 15 additions and 5 deletions

View File

@ -1,8 +1,8 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {HttpClientModule} from "@angular/common/http"; import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http";
import {BrowserModule} from '@angular/platform-browser'; import {BrowserModule, BrowserTransferStateModule} from '@angular/platform-browser';
import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {CKEditorModule} from 'ng2-ckeditor'; import {CKEditorModule} from 'ng2-ckeditor';
@ -24,6 +24,7 @@ import {LayoutService} from "./openaireLibrary/services/layout.service";
import {SubscribeModule} from './utils/subscribe/subscribe.module'; import {SubscribeModule} from './utils/subscribe/subscribe.module';
import {ThemeComponent} from "./test/theme.component"; import {ThemeComponent} from "./test/theme.component";
import {CustomizationModule} from "./utils/customization/customization.module"; import {CustomizationModule} from "./utils/customization/customization.module";
import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service";
@NgModule({ @NgModule({
@ -41,11 +42,19 @@ import {CustomizationModule} from "./utils/customization/customization.module";
CustomizationModule, CustomizationModule,
SubscribeModule.forRoot(), SubscribeModule.forRoot(),
BrowserModule.withServerTransition({appId: 'my-app'}), BrowserModule.withServerTransition({appId: 'my-app'}),
AppRoutingModule AppRoutingModule,
BrowserTransferStateModule
], ],
declarations: [ AppComponent, OpenaireErrorPageComponent, ThemeComponent], declarations: [ AppComponent, OpenaireErrorPageComponent, ThemeComponent],
exports: [ AppComponent ], exports: [ AppComponent ],
providers:[EnvironmentSpecificResolver, CommunitiesService, LayoutService], providers:[
EnvironmentSpecificResolver, CommunitiesService, LayoutService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpInterceptorService,
multi: true
}
],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
// //

View File

@ -1,5 +1,5 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {ServerModule} from '@angular/platform-server'; import {ServerModule, ServerTransferStateModule} from '@angular/platform-server';
import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader'; import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader';
import {AppModule} from './app.module'; import {AppModule} from './app.module';
@ -12,6 +12,7 @@ import {AppComponent} from './app.component';
AppModule, AppModule,
ServerModule, ServerModule,
ModuleMapLoaderModule, ModuleMapLoaderModule,
ServerTransferStateModule
], ],
// Since the bootstrapped component is not inherited from your // Since the bootstrapped component is not inherited from your
// imported AppModule, it needs to be repeated here. // imported AppModule, it needs to be repeated here.