bigbuffet-rw/app/gabsocial/reducers/meta.js

21 lines
588 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
'use strict';
import { STORE_HYDRATE } from '../actions/store';
import { ME_FETCH_SUCCESS } from 'gabsocial/actions/me';
import { Map as ImmutableMap, fromJS } from 'immutable';
2020-03-27 13:59:38 -07:00
const initialState = ImmutableMap();
2020-03-27 13:59:38 -07:00
export default function meta(state = initialState, action) {
switch(action.type) {
case STORE_HYDRATE:
return state.merge(action.state.get('meta'));
case ME_FETCH_SUCCESS:
const me = fromJS(action.me);
const pleroPrefs = me.get('pleroma').delete('settings_store');
2020-04-17 18:21:30 -07:00
return state.mergeIn(['pleroma'], pleroPrefs);
2020-03-27 13:59:38 -07:00
default:
return state;
}
};