Files
swagger-ui/src/plugins/configs/reducers.js
Josh Ponelat 50b318c5d9 Create a configs plugin
This starts to migrate configs to state
2017-10-25 09:59:54 +02:00

21 lines
381 B
JavaScript

import { fromJS } from "immutable"
import {
UPDATE_CONFIGS,
TOGGLE_CONFIGS,
} from "./actions"
export default {
[UPDATE_CONFIGS]: (state, action) => {
return state.merge(fromJS(action.payload))
},
[TOGGLE_CONFIGS]: (state, action) => {
const configName = action.payload
const oriVal = state.get(configName)
return state.set(configName, !oriVal)
},
}