0👍
I assume you are using vue-router. If yes, then you can pass along your query parameters, which are found in this.$route.query
. That property is an object, so you will probably need a library such as query-string to stringify the query.
Example code:
async getRaces () {
const response = await RacesService.getRaces(this.$route.query)
this.races = response.data.races
}
//...
import queryString from 'query-string'
getRaces (query) {
return Api().get('races/?' + queryString.stringify(query))
},
Source:stackexchange.com