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

View File

@ -1,5 +1,5 @@
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 {AppModule} from './app.module';
@ -12,6 +12,7 @@ import {AppComponent} from './app.component';
AppModule,
ServerModule,
ModuleMapLoaderModule,
ServerTransferStateModule
],
// Since the bootstrapped component is not inherited from your
// imported AppModule, it needs to be repeated here.