-
+
{{ $t('card-user-search.allowed.button') }}
@@ -49,16 +49,28 @@ const { toastError } = useAppToast()
const store = useStore()
const gmsUri = ref('not initialized')
-const gmsAllowed = computed(() => store.state.userLocation !== null)
+// console.log('store.state: gmsActive gmsAllowed userLocation=', store.state.gmsActive, store.state.gmsAllowed, store.state.userLocation)
+const gmsActive = store.state.gmsActive
+// console.log('gmsActive=', gmsActive)
+const gmsUserLocationExists = store.state.userLocation !== null
+// console.log('gmsUserLocationExists=', gmsUserLocationExists)
const { onResult, result, loading, onError } = useQuery(authenticateGmsUserSearch)
onResult(({ data }) => {
- gmsUri.value = `${data.authenticateGmsUserSearch.url}?accesstoken=${data.authenticateGmsUserSearch.token}`
+ if (gmsActive && gmsUserLocationExists && data !== undefined) {
+ gmsUri.value = `${data.authenticateGmsUserSearch.url}?accesstoken=${data.authenticateGmsUserSearch.token}`
+ }
})
onError(() => {
- toastError('authenticateGmsUserSearch failed!')
+ if (gmsActive && gmsUserLocationExists) {
+ toastError('authenticateGmsUserSearch failed!')
+ }
+ else if (gmsActive && !gmsUserLocationExists) {
+ // toastError('capture your location first!')
+ console.log('capture your location first...')
+ }
})