- implementing immutable.js

This commit is contained in:
2019-07-17 03:21:23 -04:00
parent 8ecf036cc4
commit 434a1ded24
39 changed files with 1123 additions and 187 deletions

18
app/reducers/auctions.js Normal file
View File

@@ -0,0 +1,18 @@
import { Map } from 'immutable';
import { AUCTIONS_UPDATED, UPDATE_AUCTIONS } from '../constants/actionTypes.js';
export const auctions = (state = new Map(), action) => {
switch (action.type) {
case AUCTIONS_UPDATED:
return state.merge(
action.payload.toMap().mapEntries((entry) => {
const [, item] = entry;
return [`${item.id}`, item];
}),
);
case UPDATE_AUCTIONS:
default:
return state;
}
};