To achieve the functionality of reloading the page whenever different buttons are pressed and sending a String to the same page, I need to take that String on created()
and use it to send an HTTP Get into my Database.
My current setup looks like this:
export default {
data(){
return{
events: [],
formData:{
sportType: 'Tennis'
}
}
},
created(){
// Need to implement logic here to utilize the value sent from the reload
axios.get(`http://localhost:8001/evento`, {headers: {sportType: this.formData.sportType}})
.then((response)=>{
this.events = response.events
},(error) =>{
console.log(error);
});
},
pickSport(item){
}
The pickSport()
function is triggered by button presses, with each button sending a String value to this function. The goal now is to reload the page when this function is called, in addition to sending the item
to the reloaded page so I can update the sportType
value. My attempt so far has been:
pickDesporto(item){
this.$router.push({
path: '/betting',
params: item
});
}
However, I am facing a NavigationDuplicated error with this approach. What steps can I take to resolve this issue?