Refactor point value object and add observability

This commit is contained in:
Bernard Ngandu
2025-10-10 14:55:36 +02:00
parent 8a43d3967c
commit 68eb54995f
46 changed files with 3691 additions and 229 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import type { LatLng } from '@/types/api'
import type { Point } from '@/types/api'
function geolocationErrorMessage(error: GeolocationPositionError): string {
switch (error.code) {
@@ -16,7 +16,7 @@ function geolocationErrorMessage(error: GeolocationPositionError): string {
}
export function useUserLocation() {
const [location, setLocation] = useState<LatLng | null>(null)
const [location, setLocation] = useState<Point | null>(null)
const [error, setError] = useState<string | null>(null)
const [isRequesting, setIsRequesting] = useState<boolean>(false)
const watchIdRef = useRef<number | null>(null)