|
|
|
@ -12,19 +12,39 @@ export const setSessionsList = (sessionsList: Session[]) => {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const addXlsFile = async (file: File) => {
|
|
|
|
|
try {
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', file);
|
|
|
|
|
const response = await fetch(
|
|
|
|
|
'https://r-dash.azurewebsites.net/File?' + "pseudoPilote=test_PILOTE" + "&Email=test@gmail.com" + "&password=test123" + "&nameSession=test_SESSION" + "&nameCircuit=test_CIRCUIT" + "&typeSession=Unknown", {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: formData
|
|
|
|
|
});
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
return data;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('Error---------', error);
|
|
|
|
|
// export const addXlsFile = async (file: File) => {
|
|
|
|
|
// try {
|
|
|
|
|
// const formData = new FormData();
|
|
|
|
|
// formData.append('file', file);
|
|
|
|
|
// const response = await fetch(
|
|
|
|
|
// 'https://r-dash.azurewebsites.net/File?' + "pseudoPilote=test_PILOTE" + "&Email=test@gmail.com" + "&password=test123" + "&nameSession=test_SESSION" + "&nameCircuit=test_CIRCUIT" + "&typeSession=Unknown", {
|
|
|
|
|
// method: 'POST',
|
|
|
|
|
// body: formData
|
|
|
|
|
// });
|
|
|
|
|
// const data = await response.json();
|
|
|
|
|
// return data;
|
|
|
|
|
// } catch (error) {
|
|
|
|
|
// console.log('Error---------', error);
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
export const addXlsFile = (file: File, pseudoPilote: string, email: string, password: string, nameSession: string, nameCircuit: string, typeSession: string) => {
|
|
|
|
|
return async dispatch => {
|
|
|
|
|
try {
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', file);
|
|
|
|
|
const response = await fetch(
|
|
|
|
|
`https://r-dash.azurewebsites.net/File?pseudoPilote=${pseudoPilote}&Email=${email}&password=${password}&nameSession=${nameSession}&nameCircuit=${nameCircuit}&typeSession=${typeSession}`,
|
|
|
|
|
{
|
|
|
|
|
method: 'POST',
|
|
|
|
|
body: formData
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
return data;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('Error - POST FILE', error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -39,13 +59,13 @@ export const getSessionsList = () => {
|
|
|
|
|
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["temps"], points, lap["temps"]);
|
|
|
|
|
return new Lap(lap["numero"], points, lap["temps"]);
|
|
|
|
|
});
|
|
|
|
|
return new Session(elt["name"], laps, elt["type"]);
|
|
|
|
|
});
|
|
|
|
|
dispatch(setSessionsList(sessionsList));
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('Error---------', error);
|
|
|
|
|
console.log('Error -- GET SESSIONS', error);
|
|
|
|
|
//dispatch(fetchDataRejected(error))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|