Correction envoi dernière position

This commit is contained in:
Emmy D'Anello 2024-12-13 00:32:52 +01:00
parent 1241669c35
commit 30a687018f
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
3 changed files with 8 additions and 4 deletions

View File

@ -40,7 +40,7 @@ export default function FreeChaseBanner() {
icon={({ size }) => <FontAwesome6 name={iconName} size={size} color={MD3Colors.secondary90} />}
style={{ backgroundColor: MD3Colors.secondary40 }}>
<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>
</View>
</Banner>

View File

@ -13,8 +13,8 @@ export default function GeolocationProvider({ children }: { children: ReactNode
const unqueueLocation = useUnqueueLocation()
const geolocationMutation = useGeolocationMutation({
auth,
onPostSuccess: ({ data, variables: location }) => {
unqueueLocation(location)
onPostSuccess: (data) => {
unqueueLocation(data)
geolocationMutation.reset()
},
onError: ({ response, error }) => { console.error(response, error) }

View File

@ -27,7 +27,11 @@ export const locationSlice = createSlice({
}
},
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)
},
},
})