Changement dans le service appelant l'API C#
pour avoir une conversion du JSON en model Angula
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
export class DropZoneResp {
|
||||
constructor(data: any) {
|
||||
Object.assign(this, data);
|
||||
}
|
||||
|
||||
public Id: number;
|
||||
public Latitude: string;
|
||||
public Longitude: string;
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user