about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/reducers/boosts.js
blob: 3541ca0c28e6ff74a04e2c766238caf3d0407372 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Immutable from 'immutable';

import {
  BOOSTS_INIT_MODAL,
  BOOSTS_CHANGE_PRIVACY,
} from 'flavours/glitch/actions/boosts';

const initialState = Immutable.Map({
  new: Immutable.Map({
    privacy: 'public',
  }),
});

export default function mutes(state = initialState, action) {
  switch (action.type) {
  case BOOSTS_INIT_MODAL:
    return state.withMutations((state) => {
      state.setIn(['new', 'privacy'], action.privacy);
    });
  case BOOSTS_CHANGE_PRIVACY:
    return state.setIn(['new', 'privacy'], action.privacy);
  default:
    return state;
  }
}