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 { try {
const formData = new FormData(); const formData = new FormData();
formData.append('file', file); 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', method: 'POST',
body: formData body: formData
}); });
@ -27,10 +28,10 @@ export const addXlsFile = async (file: File) => {
} }
}; };
export const getSessionsList = (user: User) => { export const getSessionsList = () => {
return async dispatch => { return async dispatch => {
try { 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 sessionsListJson = await sessionsPromise.json();
const sessionsList: Session[] = sessionsListJson.map(elt => { const sessionsList: Session[] = sessionsListJson.map(elt => {
const laps: Lap[] = elt.laps.map(lap => { const laps: Lap[] = elt.laps.map(lap => {

@ -11,7 +11,7 @@ export const setTeamsList = (teamsList: Team[]) => {
export const addNewTeam = (newTeam: Team) => { export const addNewTeam = (newTeam: Team) => {
return async dispatch => { return async dispatch => {
try { 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', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -33,7 +33,7 @@ export const addNewTeam = (newTeam: Team) => {
export const getTeamsList = () => { export const getTeamsList = () => {
return async dispatch => { return async dispatch => {
try { 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 teamsListJson = await teamsPromise.json();
const teamsList: Team[] = teamsListJson.map(elt => new Team(elt["name"], elt["owner"], elt["users"], elt["logo"])); const teamsList: Team[] = teamsListJson.map(elt => new Team(elt["name"], elt["owner"], elt["users"], elt["logo"]));
dispatch(setTeamsList(teamsList)); dispatch(setTeamsList(teamsList));

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

Loading…
Cancel
Save