about summary refs log tree commit diff
path: root/app/assets/javascripts/components/reducers/meta.jsx
blob: c7222c60b0079327a118a99e1f877f4106731da2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { ACCESS_TOKEN_SET } from '../actions/meta';
import { ACCOUNT_SET_SELF } from '../actions/accounts';
import Immutable from 'immutable';

const initialState = Immutable.Map();

export default function meta(state = initialState, action) {
  switch(action.type) {
    case ACCESS_TOKEN_SET:
      return state.set('access_token', action.token);
    case ACCOUNT_SET_SELF:
      return state.set('me', action.account.id);
    default:
      return state;
  }
};