2020-03-27 13:59:38 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import { STORE_HYDRATE } from '../actions/store';
|
2020-04-17 14:13:08 -07:00
|
|
|
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({
|
|
|
|
streaming_api_base_url: null,
|
|
|
|
access_token: null,
|
|
|
|
});
|
|
|
|
|
|
|
|
export default function meta(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case STORE_HYDRATE:
|
|
|
|
return state.merge(action.state.get('meta'));
|
2020-04-17 14:13:08 -07:00
|
|
|
case ME_FETCH_SUCCESS:
|
|
|
|
const me = fromJS(action.me);
|
|
|
|
const pleroPrefs = me.get('pleroma').delete('settings_store');
|
|
|
|
return state.set('pleroma', pleroPrefs);
|
2020-03-27 13:59:38 -07:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|