Correction envoi dernière position
This commit is contained in:
parent
1241669c35
commit
30a687018f
@ -40,7 +40,7 @@ export default function FreeChaseBanner() {
|
|||||||
icon={({ size }) => <FontAwesome6 name={iconName} size={size} color={MD3Colors.secondary90} />}
|
icon={({ size }) => <FontAwesome6 name={iconName} size={size} color={MD3Colors.secondary90} />}
|
||||||
style={{ backgroundColor: MD3Colors.secondary40 }}>
|
style={{ backgroundColor: MD3Colors.secondary40 }}>
|
||||||
<View>
|
<View>
|
||||||
<Text variant='titleMedium'>Vous pourrez vous mettre en chasse à {chaseFreePretty}.</Text>
|
<Text variant='titleMedium'>Vous pourrez commencer la poursuite à {chaseFreePretty}.</Text>
|
||||||
<Text variant='titleSmall'>Temps restant : {prettyRemainingTime}</Text>
|
<Text variant='titleSmall'>Temps restant : {prettyRemainingTime}</Text>
|
||||||
</View>
|
</View>
|
||||||
</Banner>
|
</Banner>
|
||||||
|
@ -13,8 +13,8 @@ export default function GeolocationProvider({ children }: { children: ReactNode
|
|||||||
const unqueueLocation = useUnqueueLocation()
|
const unqueueLocation = useUnqueueLocation()
|
||||||
const geolocationMutation = useGeolocationMutation({
|
const geolocationMutation = useGeolocationMutation({
|
||||||
auth,
|
auth,
|
||||||
onPostSuccess: ({ data, variables: location }) => {
|
onPostSuccess: (data) => {
|
||||||
unqueueLocation(location)
|
unqueueLocation(data)
|
||||||
geolocationMutation.reset()
|
geolocationMutation.reset()
|
||||||
},
|
},
|
||||||
onError: ({ response, error }) => { console.error(response, error) }
|
onError: ({ response, error }) => { console.error(response, error) }
|
||||||
|
@ -27,7 +27,11 @@ export const locationSlice = createSlice({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
unqueueLocation: (state, action: PayloadAction<LocationObject>) => {
|
unqueueLocation: (state, action: PayloadAction<LocationObject>) => {
|
||||||
state.queuedLocations.pop()
|
const sentLoc = action.payload
|
||||||
|
state.queuedLocations = state.queuedLocations
|
||||||
|
.filter(loc => new Date(loc.timestamp).getTime() !== sentLoc.timestamp
|
||||||
|
|| loc.coords.latitude !== sentLoc.coords.latitude
|
||||||
|
|| loc.coords.longitude !== sentLoc.coords.latitude)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user