Skip to content

Commit

Permalink
fix: missing geoloc
Browse files Browse the repository at this point in the history
  • Loading branch information
arthaud-proust committed Oct 27, 2023
1 parent 9d191aa commit a9c4216
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions resources/js/Pages/News/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const form = useForm<{
lat: number | null,
lng: number | null,
}>({
lat: null,
lng: null,
lat: 44.836151,
lng: -0.580816,
});
const {coords, locatedAt, error} = useGeolocation()
Expand All @@ -98,8 +98,13 @@ function getNews() {
return;
}
form.lng = coords.value.longitude;
form.lat = coords.value.latitude;
if (coords.value.latitude && coords.value.latitude !== Infinity) {
form.lat = coords.value.latitude;
}
if (coords.value.longitude && coords.value.longitude !== Infinity) {
form.lng = coords.value.longitude;
}
form.post(route('pigeon.get-news', newsToGet.value?.id), {
preserveScroll: true,
Expand Down

0 comments on commit a9c4216

Please sign in to comment.