feat(1099): add authenticated blob downloads to report API service

Add downloadCsv/downloadCopyB returning Blob via HttpClient so the auth
interceptor attaches the bearer token (raw window.open would 401). Remove
the now-unused copyBUrl/exportCsvUrl raw-URL builders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Chris Chen
2026-06-25 17:38:47 -07:00
parent d1747b510e
commit 6ffaaf37ac
@@ -30,11 +30,19 @@ export class Form1099ReportApiService {
});
}
copyBUrl(payeeId: number, taxYear: number): string {
return `${this.endpoint}/recipient/${payeeId}/copy-b?taxYear=${taxYear}`;
// Authenticated blob downloads: routed through HttpClient so the auth
// interceptor attaches the bearer token (a raw window.open would 401).
downloadCsv(taxYear: number): Observable<Blob> {
return this.http.get(`${this.endpoint}/export-csv`, {
params: { taxYear: String(taxYear) },
responseType: 'blob',
});
}
exportCsvUrl(taxYear: number): string {
return `${this.endpoint}/export-csv?taxYear=${taxYear}`;
downloadCopyB(payeeId: number, taxYear: number): Observable<Blob> {
return this.http.get(`${this.endpoint}/recipient/${payeeId}/copy-b`, {
params: { taxYear: String(taxYear) },
responseType: 'blob',
});
}
}