Make authentication work with interceptors
This commit is contained in:
@ -6,9 +6,11 @@ import {AppComponent} from './components/app.component';
|
||||
import {HelloComponent} from './components/hello/hello.component';
|
||||
import {BASE_PATH} from '../gen';
|
||||
import {environment} from '../environments/environment';
|
||||
import {provideHttpClient, withInterceptorsFromDi} from '@angular/common/http';
|
||||
import {HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi} from '@angular/common/http';
|
||||
import { LoginComponent } from './components/login/login.component';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {RequestInterceptor} from './interceptors/request.interceptor';
|
||||
import {UnauthorizedInterceptor} from './interceptors/unauthorizedResponseInterceptor';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -23,6 +25,8 @@ import {FormsModule} from '@angular/forms';
|
||||
],
|
||||
providers: [
|
||||
{provide: BASE_PATH, useValue: environment.apiBasePath},
|
||||
{provide: HTTP_INTERCEPTORS, useClass: UnauthorizedInterceptor, multi: true},
|
||||
{provide: HTTP_INTERCEPTORS, useClass: RequestInterceptor, multi: true},
|
||||
provideHttpClient(withInterceptorsFromDi())
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
|
Reference in New Issue
Block a user