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.

32 lines
731 B

  1. import { SETTING_CHANGE } from '../actions/settings';
  2. import { STORE_HYDRATE } from '../actions/store';
  3. import Immutable from 'immutable';
  4. const initialState = Immutable.Map({
  5. notifications: Immutable.Map({
  6. alerts: Immutable.Map({
  7. follow: true,
  8. favourite: true,
  9. reblog: true,
  10. mention: true
  11. }),
  12. shows: Immutable.Map({
  13. follow: true,
  14. favourite: true,
  15. reblog: true,
  16. mention: true
  17. })
  18. })
  19. });
  20. export default function settings(state = initialState, action) {
  21. switch(action.type) {
  22. case STORE_HYDRATE:
  23. return state.merge(action.state.get('settings'));
  24. case SETTING_CHANGE:
  25. return state.setIn(action.key, action.value);
  26. default:
  27. return state;
  28. }
  29. };