I enter my site through a reverse proxy server that is passing a token to my site. I want to be able to force that token onto the query string every time I go to a different route and I want to be able to do that without putting the query string on every "to" in any button I may have. This way if my users reload the page, they don't lose their token.
I am attempting to do this in my default.vue page so that no matter what page I am on it pushes the query string into the route. The problem I am facing is this works great when the user single clicks a button taking them to the route, however when the button is double clicked the querystring isnt being pushed onto the route.
Here is my default.vue and a snip it of the button that does the page change.
....default.vue.....
<template>
<v-app>
<banner :text="My Banner Text"/>
<v-container fluid px-0 py-0>
<v-main>
<nuxt />
<v-main>
</v-container>
</v-app>
</template>
<script>
import banner from '@/components/layouts/default/banner'
export default {
components: {
banner
},
data() => {
return {
landingRoute: null,
}
},
async fetch(){
if(this.isEmpty(this.$route.query)){
const landingkey = this.landingRoute
this.$router.push({name: this.$router.name, query: {info: landingKey}})
},
watch:{
'$route.query': '$fetch'
},
mounted(){
this.landingRoute = this.$route.query.info
},
methods: {
isEmpty(json){
return Object.keys(json).length === 0
}
}
}
</script>
...... mainNav.vue .......
This is the portion that is relevant
<v-btn
to="/request"
><span>Request</span>
</v-btn>