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