'Vue js render with different request

I am making an App with vue js and laravel using API,i am getting original data , but there is an optional parameter that i want to insert in the query to render the data accordingly, if there is no parameter detected , get the original query but if the parameter is there get the data that match the parameter. i do not know how to do it with filter() and i tried to do it with axios , but it is not working

methods : {
        fetchTransactions() {
        axios.get(linkApi + "transactions/proprietaire/" + this.getProprietaireId,
        {headers : {"Authorization" : "Bearer " + this.getToken}}
        ).then((res) => {
        this.transactions = res.data
        })
    },
  },

this one below is the function i created with the optional parameter

fetchTransactionsWithMois : function(event)
    {
        console.log(event)
        axios.get(linkApi + "transactions/proprietaire/" + this.getProprietaireId + "/" + $mois,
        {headers : {"Authorization" : "Bearer " + this.getToken}}
        ).then((res) => {
            this.transactions = res.data
            console.log("trans",this.transactions)
        })
    },

this is the filter function that i talked about earlier, this one can do what i want to do but i do not know how to filter date by month with this

    filteredTransactions() {
        return this.transactions.filter( transaction => 
        transaction.proprietaire.nom.includes(this.proprietaireSelected))       
    },
}

i do not know how can i populate the data in vue js accordingly, i aldready did my research, didn't find the answer



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source