Skip to content

Commit

Permalink
Merge pull request nukeop#262 from charjac/fix.window-control
Browse files Browse the repository at this point in the history
merge read settings with default settings
  • Loading branch information
nukeop authored Feb 12, 2019
2 parents 50564ec + c7ca8a3 commit 607b317
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/reducers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ import {
SET_STRING_OPTION,
SET_NUMBER_OPTION
} from '../actions/settings';
import settingsOptions from '../constants/settings';

const initialState = {

};
const initialState = {};
const defaultSettings = settingsOptions.reduce((acc, option) => ({
...acc,
[option.name]: option.default
}), {});

export default function SettingsReducer(state=initialState, action) {
switch (action.type) {
case READ_SETTINGS:
return Object.assign({}, action.payload);
return Object.assign(defaultSettings, action.payload);
case SET_BOOLEAN_OPTION:
case SET_STRING_OPTION:
case SET_NUMBER_OPTION:
Expand Down

0 comments on commit 607b317

Please sign in to comment.