feat: update ProductController route and enhance authentication configuration

This commit is contained in:
Marek Lesko
2025-07-29 16:23:12 +00:00
parent 9217e805e9
commit 329fb94a3a
4 changed files with 26 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
@@ -13,8 +13,9 @@ export class Login implements OnInit {
}
ngOnInit(): void {
this.httpClient.get('http://localhost:5000/api/product'
// { headers: { Authorization: `Bearer ${this.as.getAccessToken()}` } }
this.httpClient.get('http://localhost:5000/swagger/v1/swagger.json', {
headers: new HttpHeaders({ Authorization: `Bearer ${this.as.getAccessToken()}` }).append('Content-Type', 'application/json')
}
).subscribe(console.warn);
}
}