From aa9e8468d554378f42c82e6128bc230a28907aa7 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 14 Apr 2025 17:54:27 +0200 Subject: [PATCH] update user location in local store on save to update button on overview --- .../UserSettings/UserGmsLocationCapturing.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/UserSettings/UserGmsLocationCapturing.vue b/frontend/src/components/UserSettings/UserGmsLocationCapturing.vue index 8620ad318..2934afedb 100644 --- a/frontend/src/components/UserSettings/UserGmsLocationCapturing.vue +++ b/frontend/src/components/UserSettings/UserGmsLocationCapturing.vue @@ -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)