diff --git a/client/app/(tabs)/train.tsx b/client/app/(tabs)/train.tsx index 31d7857..d3339e5 100644 --- a/client/app/(tabs)/train.tsx +++ b/client/app/(tabs)/train.tsx @@ -5,7 +5,7 @@ import { TrainTrip } from '@/utils/features/train/trainSlice' import { FontAwesome6 } from '@expo/vector-icons' import { useMemo, useState } from 'react' import { FlatList, StyleSheet } from 'react-native' -import { Badge, Button, Dialog, Divider, FAB, HelperText, List, Portal, Surface, Text, TextInput } from 'react-native-paper' +import { Button, Dialog, Divider, FAB, HelperText, List, Portal, Surface, Text, TextInput } from 'react-native-paper' export default function TrainScreen() { const [addTrainVisible, setAddTrainVisible] = useState(false) @@ -24,6 +24,8 @@ export default function TrainScreen() { train.id} + ItemSeparatorComponent={() => } renderItem={(item) => } /> Durée : {duration}, distance : {distanceKm} km, coût : {cost} } /> - } diff --git a/client/components/GameProvider.tsx b/client/components/GameProvider.tsx index 7a95079..4b3a432 100644 --- a/client/components/GameProvider.tsx +++ b/client/components/GameProvider.tsx @@ -39,11 +39,11 @@ export default function GameProvider({ children }: { children: ReactNode }) { }, [playerQuery.status, playerQuery.dataUpdatedAt]) const trainsQuery = useQuery({ - queryKey: ['get-trains', auth.token], - queryFn: () => fetch(`${process.env.EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER}/trains/`, { + queryKey: ['get-trains', game.playerId, auth.token], + queryFn: () => fetch(`${process.env.EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER}/trains/?playerId=${game.playerId}`, { headers: { "Authorization": `Bearer ${auth.token}` }} ).then(resp => resp.json()), - enabled: isAuthValid(auth), + enabled: isAuthValid(auth) && !game.playerId, refetchInterval: 5000, }) useEffect(() => {