mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
Ajout zones en pavage + fix dockefiles
This commit is contained in:
@@ -5,11 +5,10 @@ import { useEffect, useState } from "react";
|
||||
* A hook that returns the location of the user and updates it periodically
|
||||
* @returns {Object} The location of the user
|
||||
*/
|
||||
export function useLocation(interval) {
|
||||
export default function useLocation(interval) {
|
||||
const [location, setLocation] = useState();
|
||||
useEffect(() => {
|
||||
function update() {
|
||||
console.log('Updating location');
|
||||
navigator.geolocation.getCurrentPosition((position) => {
|
||||
setLocation([position.coords.latitude, position.coords.longitude]);
|
||||
if(interval != Infinity) {
|
||||
@@ -21,4 +20,4 @@ export function useLocation(interval) {
|
||||
}, []);
|
||||
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user