Merge pull request #2629 from JaySoni1/bcd

fix(client-profile): handle missing profile image and remove skipErrorHandler
This commit is contained in:
Gopi Kishan
2025-09-04 16:09:37 +05:30
committed by GitHub
2 changed files with 15 additions and 7 deletions
@@ -90,12 +90,21 @@ export class ClientsViewComponent implements OnInit {
}
ngOnInit() {
this.clientsService.getClientProfileImage(this.clientViewData.id).subscribe(
(base64Image: any) => {
this.clientsService.getClientProfileImage(this.clientViewData.id).subscribe({
next: (base64Image: any) => {
this.clientImage = this._sanitizer.bypassSecurityTrustResourceUrl(base64Image);
},
(error: any) => {}
);
error: (error: any) => {
// 404 is expected when client has no profile image - not an error
if (error.status === 404) {
this.clientImage = null;
} else {
// Log other unexpected errors
console.error('Error loading client profile image:', error);
this.clientImage = null;
}
}
});
}
isActive(): boolean {
+2 -3
View File
@@ -4,6 +4,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
/** rxjs Imports */
import { Observable } from 'rxjs';
/**
* Clients service.
*/
@@ -170,9 +171,7 @@ export class ClientsService {
getClientProfileImage(clientId: string) {
const httpParams = new HttpParams().set('maxHeight', '150');
return this.http
.skipErrorHandler()
.get(`/clients/${clientId}/images`, { params: httpParams, responseType: 'text' });
return this.http.get(`/clients/${clientId}/images`, { params: httpParams, responseType: 'text' });
}
uploadClientProfileImage(clientId: string, image: File) {