Report map session only on first actual map load per application init

beta
Manuel Kasper 2024-03-01 22:17:34 +01:00
rodzic 3040dbad3e
commit 4214371ff8
4 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -17,7 +17,6 @@
</template>
<script>
import axios from 'axios'
import { MglMap, MglGeolocateControl, MglNavigationControl, MglScaleControl, MglAttributionControl } from 'vue-mapbox'
import MapRoute from './MapRoute.vue'
import MapPhoto from './MapPhoto.vue'
@ -27,6 +26,7 @@ import MapWebcams from './MapWebcams.vue'
import mapstyle from '../mixins/mapstyle.js'
import utils from '../mixins/utils.js'
import longtouch from '../mixins/longtouch.js'
import reportMapSession from '../mapsession.js'
export default {
name: 'MiniMap',
@ -173,7 +173,7 @@ export default {
}
this.highlightCurrentSummit()
axios.post(process.env.VUE_APP_API_URL + '/mapsession', { type: 'mini' })
reportMapSession()
},
onMapClicked (event) {
if (event.mapboxEvent.originalEvent.hitMarker) {

Wyświetl plik

@ -100,8 +100,6 @@ axios.interceptors.response.use(response => {
return Promise.reject(error)
})
axios.post(process.env.VUE_APP_API_URL + '/mapsession', { type: 'init' })
function startVue () {
new Vue({
store,

13
src/mapsession.js 100644
Wyświetl plik

@ -0,0 +1,13 @@
import axios from 'axios'
let mapSessionReported = false
function reportMapSession () {
if (mapSessionReported) {
return
}
axios.post(process.env.VUE_APP_API_URL + '/mapsession', { type: 'first' })
mapSessionReported = true
}
export default reportMapSession

Wyświetl plik

@ -45,6 +45,7 @@ import utils from '../mixins/utils.js'
import smptracks from '../mixins/smptracks.js'
import mapstyle from '../mixins/mapstyle.js'
import longtouch from '../mixins/longtouch.js'
import reportMapSession from '../mapsession.js'
import { MglMap, MglPopup, MglNavigationControl, MglGeolocateControl, MglScaleControl, MglAttributionControl } from 'vue-mapbox'
import MapFilterControl from '../components/MapFilterControl.vue'
@ -248,7 +249,7 @@ export default {
})
this.updateRoute()
axios.post(process.env.VUE_APP_API_URL + '/mapsession', { type: 'main' })
reportMapSession()
},
onMapClicked (event) {
if (this.$refs.draw.isDrawing() || event.mapboxEvent.originalEvent.hitMarker) {