RED-5427: catch 404 from file attributes

This commit is contained in:
Dan Percic 2022-10-20 13:25:17 +03:00
parent b7f8327990
commit e2e8bba9e1

View File

@ -1,8 +1,9 @@
import { Injectable } from '@angular/core';
import { GenericService, HeadersConfiguration, RequiredParam, Validate } from '@iqser/common-ui';
import { IPlaceholdersResponse, IReportTemplate } from '@red/domain';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
import { catchError } from 'rxjs/operators';
@Injectable({
providedIn: 'root',
@ -43,7 +44,7 @@ export class ReportTemplateService extends GenericService<unknown> {
@Validate()
getTemplatesByPlaceholder(@RequiredParam() dossierTemplateId: string, @RequiredParam() attributeId: string) {
return this._post<IReportTemplate[]>({ value: attributeId }, `templates/${dossierTemplateId}`);
return this._post<IReportTemplate[]>({ value: attributeId }, `templates/${dossierTemplateId}`).pipe(catchError(() => of([])));
}
downloadReportTemplate(dossierTemplateId: string, templateId: string, observe: 'response'): Observable<HttpResponse<Blob>>;