const filterParams = (state = [], action) => {
switch( action.type ){
case "UPDATE_CHANGED":
return Object.assign({}, state, action.payload );
case "UPDATE_ADVENTURE_STATE":
return Object.assign({}, state, action.payload );
default : return {
filter_models: {
adventure_state: null,
type_id: null,
bodies: [],
brands: [],
models: [],
countries: [],
ignore_countries: null,
ignore_brands: null,
ignore_models: null
},
additionally_filter: {
years: {
from: null,
to: null,
},
price: {
from: null,
to: null
},
auction_possible: null,
exchange_car: null,
inexpensive: null,
broken: null,
after_an_accident: null,
currency_id: null
},
region: {
regions: [],
cities: [],
search_neighborns: null
},
specifications: {
fuels: [],
transmissions: [],
count_doors: {
from: null,
to: null
},
seats_number: {
from: null,
to: null
},
volume: {
from: null,
to: null
},
power: {
from: null,
to: null
},
race: {
from: null,
to: null
},
colors: {
items: [],
metallic: null
},
options: []
},
page: null,
sort: null,
period: null
};
}
}
export default filterParams;
const filterParams = (state = [], action) => {
switch( action.type ){
case "UPDATE_CHANGED":
return Object.assign({}, state, action.payload );
case "UPDATE_ADVENTURE_STATE":
return Object.assign({}, state, action.payload );
default : return {
filter_models: {
adventure_state: null,
type_id: null,
bodies: [],
brands: [],
models: [],
countries: [],
ignore_countries: null,
ignore_brands: null,
ignore_models: null
},
additionally_filter: {
years: {
from: null,
to: null,
},
price: {
from: null,
to: null
},
auction_possible: null,
exchange_car: null,
inexpensive: null,
broken: null,
after_an_accident: null,
currency_id: null
},
region: {
regions: [],
cities: [],
search_neighborns: null
},
specifications: {
fuels: [],
transmissions: [],
count_doors: {
from: null,
to: null
},
seats_number: {
from: null,
to: null
},
volume: {
from: null,
to: null
},
power: {
from: null,
to: null
},
race: {
from: null,
to: null
},
colors: {
items: [],
metallic: null
},
options: []
},
page: null,
sort: null,
period: null
};
}
}
export default filterParams;
yearFrom : 1993,
bodies: [2,3,4]
}
Такого формата