34 lines
1012 B
TypeScript
34 lines
1012 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { map } from 'rxjs/operators';
|
|
|
|
import { ApiService } from './api.service';
|
|
import { Aeronef, AeronefByImat, AeronefByYear } from 'src/app/core/models';
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class AeronefsService {
|
|
constructor(
|
|
private apiService: ApiService
|
|
) { }
|
|
|
|
getAllByImat(): Observable<Array<AeronefByImat>> {
|
|
return this.apiService.get('/aeronefs')
|
|
.pipe(map(data => data.aeronefs));
|
|
/*
|
|
//return this.apiService.get('/aeronefs');
|
|
return this.apiService.get('/aeronefs')
|
|
.pipe(map(data => {
|
|
return {
|
|
aeronefs: <Array<Aeronef>>data.aeronefs,
|
|
aeronefsCount: <number>data.aeronefsCount
|
|
};
|
|
}));
|
|
*/
|
|
}
|
|
|
|
getAllByDate(): Observable<Array<AeronefByYear>> {
|
|
return this.apiService.get('/aeronefs/allByDate')
|
|
.pipe(map(data => data.aeronefs));
|
|
}
|
|
|
|
} |