mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
change init-control depending on gsmAtive and gmsUserLocationExists
This commit is contained in:
parent
e789db7305
commit
47454b4ebb
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="mb-3 p-3 card-user-search">
|
||||
<div v-if="gmsActive" class="mb-3 p-3 card-user-search">
|
||||
<BContainer class="bg-white app-box-shadow gradido-border-radius p-4 mt--3 container">
|
||||
<div class="h3">{{ $t('card-user-search.headline') }}</div>
|
||||
<div v-if="gmsAllowed" class="my-3 text-small">
|
||||
<div v-if="gmsUserLocationExists" class="my-3 text-small">
|
||||
<span
|
||||
v-for="(line, lineNumber) of $t('card-user-search.allowed.text').split('\n')"
|
||||
:key="lineNumber"
|
||||
@ -23,7 +23,7 @@
|
||||
<BRow class="my-1">
|
||||
<BCol cols="12">
|
||||
<div class="text-lg-end">
|
||||
<BButton v-if="gmsAllowed" variant="gradido" :href="gmsUri" target="_blank">
|
||||
<BButton v-if="gmsUserLocationExists" variant="gradido" :href="gmsUri" target="_blank">
|
||||
{{ $t('card-user-search.allowed.button') }}
|
||||
</BButton>
|
||||
<RouterLink v-else to="/settings/extern">
|
||||
@ -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...')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user