I am currently developing a car rental application as a personal project. Within the /vehicles route, there are lists of available vehicles. I have included 5 select inputs on the left sidebar for filtering purposes. My goal is to apply a filter when a value is selected and remove it when no value is selected. I am struggling with deciding how to properly structure the query and data transmission process. Can anyone offer assistance?
subscription Vehicles($daily_price: String) {
vehicles(where: { _or: { daily_price: $daily_price, fuel: {}, gear: {}, model_id: {}, brand_id: {} } }) {
id
fuel
}
const { data, loading, error } = useSubscription(from && to ? VEHICLES_BY_DATE_RANGE : VEH_SUBS, {
variables: {
...filters,
},
});