From f77504073878af108bc7232f51786df4e23bcee9 Mon Sep 17 00:00:00 2001 From: Art Date: Mon, 13 Sep 2021 21:00:22 +0300 Subject: [PATCH] 122. Configure HTTP Interceptor (#14) --- support-portal-frontend/src/app/app.module.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/support-portal-frontend/src/app/app.module.ts b/support-portal-frontend/src/app/app.module.ts index bd96530..fe28a54 100644 --- a/support-portal-frontend/src/app/app.module.ts +++ b/support-portal-frontend/src/app/app.module.ts @@ -2,7 +2,10 @@ import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {AppComponent} from './app.component'; -import {HttpClientModule} from "@angular/common/http"; +import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http"; +import {AuthenticationService} from "./service/authentication.service"; +import {UserService} from "./service/user.service"; +import {AuthInterceptor} from "./interceptor/auth.interceptor"; @NgModule({ declarations: [ @@ -12,7 +15,10 @@ import {HttpClientModule} from "@angular/common/http"; BrowserModule, HttpClientModule ], - providers: [], + providers: [AuthenticationService, UserService, + {provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true} + ], bootstrap: [AppComponent] }) -export class AppModule { } +export class AppModule { +}