Make WS work with Auth

This commit is contained in:
aditya.chandel
2025-02-16 00:32:50 -07:00
parent d3627a2d3f
commit 4354a43af7
24 changed files with 243 additions and 89 deletions
+19
View File
@@ -0,0 +1,19 @@
import { Pipe, PipeTransform } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Pipe({
name: 'secure',
pure: true
})
export class SecurePipe implements PipeTransform {
constructor(private http: HttpClient, private sanitizer: DomSanitizer) {}
transform(url: string): Observable<SafeUrl> {
return this.http.get(url, { responseType: 'blob' }).pipe(
map(blob => this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(blob)))
);
}
}