Merge branch 'redux' into Dev

# Conflicts:
#	R-Dash/screens/NewTrack.tsx
redux
mohamed 2 years ago
commit f3f41a2b94

@ -16,7 +16,8 @@ export const addXlsFile = async (file: File) => {
try {
const formData = new FormData();
formData.append('file', file);
const response = await fetch('https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container/upload', {
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
});
@ -27,10 +28,10 @@ export const addXlsFile = async (file: File) => {
}
};
export const getSessionsList = (user: User) => {
export const getSessionsList = () => {
return async dispatch => {
try {
const sessionsPromise = await fetch('https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container/Sessions/'+user.getUsername);
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 => {

@ -11,7 +11,7 @@ export const setTeamsList = (teamsList: Team[]) => {
export const addNewTeam = (newTeam: Team) => {
return async dispatch => {
try {
const response = await fetch('https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container/Ecuries', {
const response = await fetch('https://r-dash.azurewebsites.net/Ecuries?' + "Email=test@gmail.com" + "&password=test123" + "&pseudoPilote=test_PILOTE", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -33,7 +33,7 @@ export const addNewTeam = (newTeam: Team) => {
export const getTeamsList = () => {
return async dispatch => {
try {
const teamsPromise = await fetch('https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container/Ecuries');
const teamsPromise = await fetch('https://r-dash.azurewebsites.net/Ecuries');
const teamsListJson = await teamsPromise.json();
const teamsList: Team[] = teamsListJson.map(elt => new Team(elt["name"], elt["owner"], elt["users"], elt["logo"]));
dispatch(setTeamsList(teamsList));

@ -22,16 +22,12 @@ export default function CreateTeam(props: { navigation: any }) {
}
};
const nList = useSelector(state => state.appReducer.teams);
const dispatch = useDispatch();
useEffect(() => {
const addTeams = async () => {
await dispatch(addNewTeam());
};
addTeams();
}, [dispatch]);
const onPressAddTeam = async () => {
dispatch();
navigation.goBack();
};
return (
<SafeAreaView style={styles.container}>
@ -67,7 +63,7 @@ export default function CreateTeam(props: { navigation: any }) {
source={require('../assets/images/return.png')}
/>
</Pressable>
<Pressable style={styles.button} onPress={() => navigation.goBack()}>
<Pressable style={styles.button} onPress={onPressAddTeam}>
<Image
style={styles.return}
source={require('../assets/images/checked.png')}

Loading…
Cancel
Save