diff --git a/src/App.vue b/src/App.vue index 72dc531353df752d44a5bf55e9256e3c7b050356..973b223ed8f2a2dd7f0b2c9452c002b7a8a96d6d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,7 @@ export default defineComponent({ ...mapActions('firebase', ['handleAuthStateChanged']) }, - mounted() { + created() { this.handleAuthStateChanged() } }) diff --git a/src/components/GoogleMap.vue b/src/components/GoogleMap.vue index 88f47c18369953a11eb3b07c82cfef9e15a0636d..25f4e00339184301849d9278a0d07b48e999af26 100644 --- a/src/components/GoogleMap.vue +++ b/src/components/GoogleMap.vue @@ -15,7 +15,7 @@ q-btn( color='grey-10', icon='my_location', style='position: absolute; right: 1.25em; bottom: 2.5em; z-index: 1' -) +) </template> <script> @@ -247,6 +247,9 @@ export default { for (const userId in this.users) { this.mapsAddUserMarker(userId) } + + // Reinitialize user on the map + this.geolocate() }, /* Creates markers and infoWindows for every relevant nightlife establishment in the area */ diff --git a/src/store/firebase.js b/src/store/firebase.js index 0e24e926c8029e0996d9b273265a5635ab9d9f64..1cfb9d19267bcff47b53f03d1fbbbcaea8b5b557 100644 --- a/src/store/firebase.js +++ b/src/store/firebase.js @@ -384,7 +384,10 @@ const actions = { firebaseSavePosition({ state, commit }, payload) { let center = payload // Update position in the db - firebaseDb.ref('status/' + state.userDetails.userId).update({position: center}) + if (state.userDetails.userId) { + firebaseDb.ref('status/' + state.userDetails.userId).update({position: center}) + } + // Update position in the store commit('setUserCenter', center) },