My page has two dynamic parameters that trigger the fetch method to run again when the URL params are changed. I want to avoid this behavior.
Fetch Method:
async fetch() {
await this.getFlightResult();
}
Get Result Method:
async getResult() {
this.$router.push({
path: `/air/${originCity?.id}-${destinationCity?.id}/${originCity?.name}-${destinationCity?.name}`,
});
await this.getFlightResult();
}
Get Flight Result Method:
async getFlightResult(){
const { data } = await this.$axios.get(`/api/v1/flights')
}
When changing the URL params, both the fetch and getResult methods are triggered simultaneously, causing unwanted behavior.