The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 line
621 B

  1. import { Map as ImmutableMap } from 'immutable';
  2. import { HEIGHT_CACHE_SET, HEIGHT_CACHE_CLEAR } from '../actions/height_cache';
  3. const initialState = ImmutableMap();
  4. const setHeight = (state, key, id, height) => {
  5. return state.update(key, ImmutableMap(), map => map.set(id, height));
  6. };
  7. const clearHeights = () => {
  8. return ImmutableMap();
  9. };
  10. export default function statuses(state = initialState, action) {
  11. switch(action.type) {
  12. case HEIGHT_CACHE_SET:
  13. return setHeight(state, action.key, action.id, action.height);
  14. case HEIGHT_CACHE_CLEAR:
  15. return clearHeights();
  16. default:
  17. return state;
  18. }
  19. };