New view of list
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { DropZoneResp } from '../models/dropzone';
|
||||
import { JumpResp } from '../models/jump';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { tap, map } from 'rxjs/operators';
|
||||
import { AircraftResp } from '../models/aircraft';
|
||||
import { JumpTypeResp } from '../models/jumpType';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class ServiceApi {
|
||||
private readonly headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
||||
});
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
public getListOfDropZones(): Observable<Array<DropZoneResp>> {
|
||||
const headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
||||
});
|
||||
|
||||
return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: headers })
|
||||
return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: this.headers })
|
||||
.pipe(
|
||||
map(response => {
|
||||
const details = response.map(data => new DropZoneResp(data));
|
||||
@@ -24,10 +27,14 @@ export class ServiceApi {
|
||||
}
|
||||
|
||||
public getListOfJumps(): Observable<Array<JumpResp>> {
|
||||
const headers = new HttpHeaders({
|
||||
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
||||
});
|
||||
return this.http.get<Array<JumpResp>>('http://localhost:5000/api/Jump', { headers: this.headers });
|
||||
}
|
||||
|
||||
return this.http.get<Array<JumpResp>>('http://localhost:5000/api/Jump', { headers: headers });
|
||||
public getListOfAircrafts(): Observable<Array<AircraftResp>> {
|
||||
return this.http.get<Array<AircraftResp>>('http://localhost:5000/api/Aircraft', { headers: this.headers });
|
||||
}
|
||||
|
||||
public getListOfJumpTypes(): Observable<Array<JumpTypeResp>> {
|
||||
return this.http.get<Array<JumpTypeResp>>('http://localhost:5000/api/JumpType', { headers: this.headers });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user