Updated export functionality

This commit is contained in:
Erik Tiekstra
2021-11-11 12:31:06 +01:00
parent f332dd41e2
commit c6adc71f77
5 changed files with 36 additions and 14 deletions

View File

@@ -2,4 +2,5 @@ export interface DeltagareExportRequest {
startDate?: string;
endDate?: string;
includeExportedDeltagare: boolean;
exportToExcel?: boolean;
}

View File

@@ -1,9 +1,9 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Params } from '@angular/router';
import { ErrorType } from '@msfa-enums/error-type.enum';
import { environment } from '@msfa-environment';
import { DeltagareExportRequest } from '@msfa-models/api/deltagare-export.request.model';
import { Params } from '@msfa-models/api/params.model';
import { CustomError } from '@msfa-models/error/custom-error';
import { Observable } from 'rxjs';
import { catchError } from 'rxjs/operators';
@@ -23,7 +23,7 @@ export class ExportApiService {
};
return this.httpClient
.post<Blob>(`${this._apiBaseUrl}/deltagare`, { params, responseType: 'blob' })
.get<Blob>(`${this._apiBaseUrl}/deltagare`, { params, responseType: 'blob' as 'json' })
.pipe(
catchError((error: Error) => {
throw new CustomError({