check poi, latitude, longitude and alert message befor post to api

This commit is contained in:
Warunee Tamkoo 2025-06-13 12:28:48 +07:00
parent cbfb7cdfdd
commit cfaf841119
2 changed files with 11 additions and 5 deletions

View file

@ -210,10 +210,18 @@ const requestLocationPermission = () => {
}
navigator.geolocation.getCurrentPosition(
() => {
(position) => {
// Permission granted
locationGranted.value = true
const { latitude, longitude } = position.coords
// console.log('Current position:', latitude, longitude)
if (!latitude || !longitude) {
messageError($q, '', 'ไม่สามารถระบุตำแหน่งปัจจุบันได้')
return
}
// Center map on user's location if map is initialized
initializeMap()
},