core-app-worona
Advanced tools
Comparing version 1.3.10 to 1.3.11
{ | ||
"name": "core-app-worona", | ||
"version": "1.3.10", | ||
"version": "1.3.11", | ||
"description": "Core Package of Worona App", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -10,3 +10,3 @@ import * as types from '../types'; | ||
export const settingUpdated = ({ _id, namespace, fields }) => | ||
({ type: types.SETTING_UPDATED, _id, namespace, fields }); | ||
export const settingsUpdated = ({ _id, namespace, fields }) => | ||
({ type: types.SETTINGS_UPDATED, _id, namespace, fields }); |
import { combineReducers } from 'redux'; | ||
import { findKey } from 'lodash'; | ||
import * as types from '../types'; | ||
@@ -8,2 +9,7 @@ | ||
return { ...state, ...action.settings }; | ||
case types.SETTINGS_UPDATED: { | ||
const namespace = action.namespace ? action.namespace : findKey(state, (value, key) => | ||
value._id === action._id || key === action.namespace); | ||
return { ...state, [namespace]: { ...action.fields, _id: action._id } }; | ||
} | ||
default: | ||
@@ -10,0 +16,0 @@ return state; |
@@ -5,2 +5,2 @@ export const APP_SETTINGS_REQUESTED = 'settings/APP_SETTINGS_REQUESTED'; | ||
export const SETTING_UPDATED = 'settings/SETTING_UPDATED'; | ||
export const SETTINGS_UPDATED = 'settings/SETTINGS_UPDATED'; |
48737
1114