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
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { AuthService } from './auth.service';
describe('AuthService', () => {
let service: AuthService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AuthService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+12
View File
@@ -0,0 +1,12 @@
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class AuthService {
getApiKey(): string{
return environment.apiKey;
}
}