Sort movies by year by default
This commit is contained in:
parent
80dba4e4d3
commit
42bc4bf957
@ -18,6 +18,8 @@ export default function movieStore(state = defaultState, action) {
|
||||
let selectedImdbId = "";
|
||||
// Select the first movie
|
||||
if (action.payload.data.length > 0) {
|
||||
// Sort by year
|
||||
action.payload.data.sort((a,b) => b.year - a.year);
|
||||
selectedImdbId = action.payload.data[0].imdb_id;
|
||||
}
|
||||
return Object.assign({}, state, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user