MyCrypto/common/reducers/config.js

37 lines
790 B
JavaScript
Raw Normal View History

2017-06-26 15:27:55 -07:00
// @flow
import {
CONFIG_LANGUAGE_CHANGE,
2017-05-23 16:06:01 -07:00
CONFIG_NODE_CHANGE
} from 'actions/config';
import {languages, nodeList} from '../config/data';
2017-06-26 15:27:55 -07:00
export type State = {
// FIXME
languageSelection: string,
nodeSelection: string
}
const initialState = {
2017-05-23 16:06:01 -07:00
languageSelection: languages[0],
nodeSelection: nodeList[0]
}
2017-06-26 15:27:55 -07:00
export function config(state: State = initialState, action): State {
switch (action.type) {
case CONFIG_LANGUAGE_CHANGE: {
return {
...state,
2017-05-23 16:06:01 -07:00
languageSelection: action.value
}
}
case CONFIG_NODE_CHANGE: {
return {
...state,
2017-05-23 16:06:01 -07:00
nodeSelection: action.value
}
}
default:
return state
}
}