added AuthInterceptor for sending api key in the header on every request to api

This commit is contained in:
2024-04-28 14:03:41 +05:30
parent ad3df7c6b5
commit 1d53333667
8 changed files with 64 additions and 7 deletions
+4 -2
View File
@@ -1,5 +1,6 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { ContactSidebarComponent } from './contact-sidebar/contact-sidebar.component';
@@ -10,7 +11,8 @@ import { ProjectsComponent } from './projects/projects.component';
import { BlogComponent } from './blog/blog.component';
import { ContactComponent } from './contact/contact.component';
import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule } from '@angular/common/http';
import { AuthInterceptor } from './http-interceptors/auth.interceptor';
import { httpInterceptorProviders } from './http-interceptors';
@NgModule({
declarations: [
@@ -29,7 +31,7 @@ import { HttpClientModule } from '@angular/common/http';
AppRoutingModule
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [],
providers: [httpInterceptorProviders],
bootstrap: [AppComponent]
})
export class AppModule { }