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 {
|
export class DropZoneResp {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
public Id: number;
|
public Id: number;
|
||||||
public Latitude: string;
|
public Latitude: string;
|
||||||
public Longitude: string;
|
public Longitude: string;
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ export class ServiceApi {
|
|||||||
|
|
||||||
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: headers })
|
||||||
.pipe(
|
.pipe(
|
||||||
map(x => x.map(data => new DropZoneResp(data))),
|
map(response => {
|
||||||
// tap(event => console.log(`fetched coinrankings`)),
|
const details = response.map(data => new DropZoneResp(data));
|
||||||
// catchError(this.handleError('getCoinrankings', []))
|
return details;
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user