Changement dans le service appelant l'API C#

pour avoir une conversion du JSON en model Angula
This commit is contained in:
Sébastien André
2019-10-07 15:17:47 +02:00
parent b98adf88ca
commit 11cdcba702
2 changed files with 8 additions and 3 deletions

View File

@@ -1,4 +1,8 @@
export class DropZoneResp {
constructor(data: any) {
Object.assign(this, data);
}
public Id: number;
public Latitude: string;
public Longitude: string;

View File

@@ -16,9 +16,10 @@ export class ServiceApi {
return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: headers })
.pipe(
map(x => x.map(data => new DropZoneResp(data))),
// tap(event => console.log(`fetched coinrankings`)),
// catchError(this.handleError('getCoinrankings', []))
map(response => {
const details = response.map(data => new DropZoneResp(data));
return details;
})
);
}