MyCrypto/common/reducers/config.js

34 lines
693 B
JavaScript
Raw Normal View History

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