|
|
|
@ -34,14 +34,14 @@ export const getSessionsList = () => {
|
|
|
|
|
const sessionsPromise = await fetch('https://r-dash.azurewebsites.net/FullSession');
|
|
|
|
|
const sessionsListJson = await sessionsPromise.json();
|
|
|
|
|
const sessionsList: Session[] = sessionsListJson.map(elt => {
|
|
|
|
|
const laps: Lap[] = elt.laps.map(lap => {
|
|
|
|
|
const points: Point[] = lap.points.map(point => {
|
|
|
|
|
const geo = new Geocalisation(point.geo.latitude, point.geo.longitude);
|
|
|
|
|
return new Point(geo, point.timer, point.distance, point.nGear, point.pBrakeF, point.aSteer, point.rPedal, point.gLong, point.gLat, point.vCar);
|
|
|
|
|
const laps: Lap[] = elt["tours"].map(lap => {
|
|
|
|
|
const points: Point[] = lap["points"].map(point => {
|
|
|
|
|
const geo = new Geocalisation(point["longitude"], point["latitude"]);
|
|
|
|
|
return new Point(geo, point["timer"] , point["distance"], point["nGear"], point["pBrakeF"], point["aSteer"], point["rPedal"], point["gLong"], point["gLat"], point["vCar"]);
|
|
|
|
|
});
|
|
|
|
|
return new Lap(lap.number, points, lap.time);
|
|
|
|
|
return new Lap(lap["temps"], points, lap["temps"]);
|
|
|
|
|
});
|
|
|
|
|
return new Session(elt.name, laps, elt.type);
|
|
|
|
|
return new Session(elt["name"], laps, elt["type"]);
|
|
|
|
|
});
|
|
|
|
|
dispatch(setSessionsList(sessionsList));
|
|
|
|
|
} catch (error) {
|
|
|
|
|