mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fix issue where interceptors were executed multiple times for each request
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { APP_BASE_HREF, CommonModule } from '@angular/common';
|
import { APP_BASE_HREF, CommonModule } from '@angular/common';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
||||||
|
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
@@ -40,6 +40,8 @@ import { BreadcrumbsComponent } from './breadcrumbs/breadcrumbs.component';
|
|||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { ForbiddenComponent } from './forbidden/forbidden.component';
|
import { ForbiddenComponent } from './forbidden/forbidden.component';
|
||||||
|
import { AuthInterceptor } from './core/auth/auth.interceptor';
|
||||||
|
import { LocaleInterceptor } from './core/locale/locale.interceptor';
|
||||||
|
|
||||||
export function getBase() {
|
export function getBase() {
|
||||||
return environment.ui.nameSpace;
|
return environment.ui.nameSpace;
|
||||||
@@ -94,6 +96,18 @@ const PROVIDERS = [
|
|||||||
deps: [ Store ],
|
deps: [ Store ],
|
||||||
multi: true
|
multi: true
|
||||||
},
|
},
|
||||||
|
// register AuthInterceptor as HttpInterceptor
|
||||||
|
{
|
||||||
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
useClass: AuthInterceptor,
|
||||||
|
multi: true
|
||||||
|
},
|
||||||
|
// register LocaleInterceptor as HttpInterceptor
|
||||||
|
{
|
||||||
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
useClass: LocaleInterceptor,
|
||||||
|
multi: true
|
||||||
|
},
|
||||||
...DYNAMIC_MATCHER_PROVIDERS,
|
...DYNAMIC_MATCHER_PROVIDERS,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -32,7 +32,6 @@ import { SidebarService } from '../shared/sidebar/sidebar.service';
|
|||||||
import { UploaderService } from '../shared/uploader/uploader.service';
|
import { UploaderService } from '../shared/uploader/uploader.service';
|
||||||
import { SectionFormOperationsService } from '../submission/sections/form/section-form-operations.service';
|
import { SectionFormOperationsService } from '../submission/sections/form/section-form-operations.service';
|
||||||
import { AuthRequestService } from './auth/auth-request.service';
|
import { AuthRequestService } from './auth/auth-request.service';
|
||||||
import { AuthInterceptor } from './auth/auth.interceptor';
|
|
||||||
import { AuthenticatedGuard } from './auth/authenticated.guard';
|
import { AuthenticatedGuard } from './auth/authenticated.guard';
|
||||||
import { AuthStatus } from './auth/models/auth-status.model';
|
import { AuthStatus } from './auth/models/auth-status.model';
|
||||||
import { BrowseService } from './browse/browse.service';
|
import { BrowseService } from './browse/browse.service';
|
||||||
@@ -132,7 +131,6 @@ import { ProcessDataService } from './data/processes/process-data.service';
|
|||||||
import { ScriptDataService } from './data/processes/script-data.service';
|
import { ScriptDataService } from './data/processes/script-data.service';
|
||||||
import { WorkflowActionDataService } from './data/workflow-action-data.service';
|
import { WorkflowActionDataService } from './data/workflow-action-data.service';
|
||||||
import { WorkflowAction } from './tasks/models/workflow-action-object.model';
|
import { WorkflowAction } from './tasks/models/workflow-action-object.model';
|
||||||
import { LocaleInterceptor } from './locale/locale.interceptor';
|
|
||||||
import { ItemTemplateDataService } from './data/item-template-data.service';
|
import { ItemTemplateDataService } from './data/item-template-data.service';
|
||||||
import { TemplateItem } from './shared/template-item.model';
|
import { TemplateItem } from './shared/template-item.model';
|
||||||
import { Feature } from './shared/feature.model';
|
import { Feature } from './shared/feature.model';
|
||||||
@@ -279,18 +277,6 @@ const PROVIDERS = [
|
|||||||
EndUserAgreementCurrentUserGuard,
|
EndUserAgreementCurrentUserGuard,
|
||||||
EndUserAgreementCookieGuard,
|
EndUserAgreementCookieGuard,
|
||||||
EndUserAgreementService,
|
EndUserAgreementService,
|
||||||
// register AuthInterceptor as HttpInterceptor
|
|
||||||
{
|
|
||||||
provide: HTTP_INTERCEPTORS,
|
|
||||||
useClass: AuthInterceptor,
|
|
||||||
multi: true
|
|
||||||
},
|
|
||||||
// register LocaleInterceptor as HttpInterceptor
|
|
||||||
{
|
|
||||||
provide: HTTP_INTERCEPTORS,
|
|
||||||
useClass: LocaleInterceptor,
|
|
||||||
multi: true
|
|
||||||
},
|
|
||||||
NotificationsService,
|
NotificationsService,
|
||||||
FilteredDiscoveryPageResponseParsingService,
|
FilteredDiscoveryPageResponseParsingService,
|
||||||
{ provide: NativeWindowService, useFactory: NativeWindowFactory },
|
{ provide: NativeWindowService, useFactory: NativeWindowFactory },
|
||||||
|
Reference in New Issue
Block a user