Settings: change setSettings action to merge with state.

It was overriding state before.
master
Andrew P Maney 5 years ago committed by Tom Hacohen
parent 9f618ab36c
commit a2d6dacbe4

@ -213,7 +213,7 @@ export const clearErros = createAction(
// FIXME: Move the rest to their own file // FIXME: Move the rest to their own file
export const setSettings = createAction( export const setSettings = createAction(
'SET_SETTINGS', 'SET_SETTINGS',
(settings: SettingsType) => { (settings: Partial<SettingsType>) => {
return { ...settings }; return { ...settings };
} }
); );

@ -276,8 +276,8 @@ export interface SettingsType {
export const settingsReducer = handleActions( export const settingsReducer = handleActions(
{ {
[actions.setSettings.toString()]: (_state: {key: string | null}, action: any) => ( [actions.setSettings.toString()]: (state: { key: string | null }, action: any) => (
{ ...action.payload } { ...state, ...action.payload }
), ),
}, },
{ locale: 'en-gb' } { locale: 'en-gb' }

Loading…
Cancel
Save