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
export const setSettings = createAction(
'SET_SETTINGS',
(settings: SettingsType) => {
(settings: Partial<SettingsType>) => {
return { ...settings };
}
);

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

Loading…
Cancel
Save