-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update loading service & api interceptor
- Loading branch information
1 parent
1f3bcc9
commit 5c19066
Showing
5 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
marketplace-ui/src/app/modules/security-monitor/security-monitor.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
import { HttpClient, HttpContext, HttpHeaders } from '@angular/common/http'; | ||
import { inject, Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { environment } from '../../../environments/environment'; | ||
import { ProductSecurityInfo } from '../../shared/models/product-security-info-model'; | ||
import { LoadingComponent } from '../../core/interceptors/api.interceptor'; | ||
import { LoadingComponentId } from '../../shared/enums/loading-component-id'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class SecurityMonitorService { | ||
|
||
private readonly apiUrl = environment.apiUrl + '/api/security-monitor'; | ||
private readonly http = inject(HttpClient); | ||
|
||
getSecurityDetails(token: string): Observable<ProductSecurityInfo[]> { | ||
const headers = new HttpHeaders().set('Authorization', `Bearer ${token}`); | ||
return this.http.get<ProductSecurityInfo[]>(this.apiUrl, { headers }); | ||
return this.http.get<ProductSecurityInfo[]>(this.apiUrl, { | ||
headers, | ||
context: new HttpContext().set( | ||
LoadingComponent, | ||
LoadingComponentId.SECURITY_MONITOR | ||
) | ||
}); | ||
} | ||
} |