verdnatura-chat/app/reducers/sortPreferences.js

29 lines
590 B
JavaScript
Raw Normal View History

import { SORT_PREFERENCES } from '../actions/actionsTypes';
2022-01-24 20:12:36 +00:00
import { DisplayMode, SortBy } from '../constants/constantDisplayMode';
const initialState = {
2022-01-24 20:12:36 +00:00
sortBy: SortBy.Activity,
2018-12-05 20:52:08 +00:00
groupByType: false,
showFavorites: false,
2021-10-28 17:48:53 +00:00
showUnread: false,
showAvatar: true,
2022-01-24 20:12:36 +00:00
displayMode: DisplayMode.Expanded
};
export default (state = initialState, action) => {
switch (action.type) {
case SORT_PREFERENCES.SET_ALL:
return {
...state,
...action.preferences
};
case SORT_PREFERENCES.SET:
return {
...state,
...action.preference
};
default:
return state;
}
};