mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
update user location in local store on save to update button on overview
This commit is contained in:
parent
a3f984b613
commit
aa9e8468d5
@ -33,8 +33,10 @@ import UserLocationMap from '@/components/UserSettings/UserLocationMap'
|
||||
import { BButton, BModal } from 'bootstrap-vue-next'
|
||||
import { userLocationQuery } from '@/graphql/queries'
|
||||
import CONFIG from '@/config'
|
||||
import { useStore } from 'vuex'
|
||||
|
||||
const { t } = useI18n()
|
||||
const store = useStore()
|
||||
const { mutate: updateUserInfo } = useMutation(updateUserInfos)
|
||||
const { onResult, onError } = useQuery(userLocationQuery, {}, { fetchPolicy: 'network-only' })
|
||||
const { toastSuccess, toastError } = useAppToast()
|
||||
@ -73,14 +75,11 @@ const saveUserLocation = async () => {
|
||||
try {
|
||||
const loc = { longitude: capturedLocation.value.lng, latitude: capturedLocation.value.lat }
|
||||
|
||||
await updateUserInfo({
|
||||
gmsLocation: {
|
||||
longitude: capturedLocation.value.lng,
|
||||
latitude: capturedLocation.value.lat,
|
||||
},
|
||||
})
|
||||
await updateUserInfo({ gmsLocation: loc })
|
||||
toastSuccess(t('settings.GMS.location.updateSuccess'))
|
||||
userLocation.value = capturedLocation.value
|
||||
// update in local storage to update button on overview
|
||||
store.commit('userLocation', loc)
|
||||
isModalOpen.value = false
|
||||
} catch (error) {
|
||||
toastError(error.message)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user