feat: add import to excel
Made at the request of the customer
This commit is contained in:
@ -23,7 +23,7 @@ export enum AvailableVersion {
|
||||
|
||||
@Injectable()
|
||||
export default abstract class ApiService {
|
||||
constructor(private http: HttpClient, private notify: ToastrService, private router: Router) {
|
||||
constructor(protected http: HttpClient, protected notify: ToastrService, private router: Router) {
|
||||
}
|
||||
|
||||
private apiUrl = environment.apiUrl;
|
||||
@ -65,7 +65,7 @@ export default abstract class ApiService {
|
||||
return this.http.request<Type>(method, doneEndpoint, {
|
||||
withCredentials: request.withCredentials,
|
||||
headers: request.httpHeaders,
|
||||
body: request.data
|
||||
body: request.data,
|
||||
}).pipe(
|
||||
catchError(error => {
|
||||
if (!secondTry && error.status === 401)
|
||||
|
22
src/api/v1/import.service.ts
Normal file
22
src/api/v1/import.service.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import {Injectable} from "@angular/core";
|
||||
import ApiService, {AvailableVersion} from "@api/api.service";
|
||||
import {ScheduleRequest} from "@api/v1/scheduleRequest";
|
||||
|
||||
@Injectable()
|
||||
export class ImportService extends ApiService {
|
||||
public readonly basePath = 'Import/';
|
||||
public readonly version = AvailableVersion.v1;
|
||||
|
||||
public importToExcel(data: ScheduleRequest) {
|
||||
let request = this.createRequestBuilder()
|
||||
.setData(data)
|
||||
.setEndpoint('ImportToExcel')
|
||||
.build;
|
||||
|
||||
console.log(this.combinedUrl(request));
|
||||
console.log(data);
|
||||
return this.http.post(this.combinedUrl(request), data, {
|
||||
responseType: 'blob'
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user