The code powering m.abunchtell.com https://m.abunchtell.com
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

27 строки
691 B

  1. import {
  2. ALERT_SHOW,
  3. ALERT_DISMISS,
  4. ALERT_CLEAR,
  5. } from '../actions/alerts';
  6. import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
  7. const initialState = ImmutableList([]);
  8. export default function alerts(state = initialState, action) {
  9. switch(action.type) {
  10. case ALERT_SHOW:
  11. return state.push(ImmutableMap({
  12. key: state.size > 0 ? state.last().get('key') + 1 : 0,
  13. title: action.title,
  14. message: action.message,
  15. message_values: action.message_values,
  16. }));
  17. case ALERT_DISMISS:
  18. return state.filterNot(item => item.get('key') === action.alert.key);
  19. case ALERT_CLEAR:
  20. return state.clear();
  21. default:
  22. return state;
  23. }
  24. };