2017-04-14 06:25:01 +00:00
|
|
|
import {
|
|
|
|
CONFIG_LANGUAGE_CHANGE,
|
2017-05-23 23:06:01 +00:00
|
|
|
CONFIG_NODE_CHANGE
|
|
|
|
} from 'actions/config';
|
|
|
|
import {languages, nodeList} from '../config/data';
|
2017-04-14 06:25:01 +00:00
|
|
|
|
|
|
|
const initialState = {
|
2017-05-23 23:06:01 +00:00
|
|
|
languageSelection: languages[0],
|
|
|
|
nodeSelection: nodeList[0]
|
2017-04-14 06:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function config(state = initialState, action) {
|
|
|
|
switch (action.type) {
|
|
|
|
case CONFIG_LANGUAGE_CHANGE: {
|
|
|
|
return {
|
|
|
|
...state,
|
2017-05-23 23:06:01 +00:00
|
|
|
languageSelection: action.value
|
2017-04-14 06:25:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
case CONFIG_NODE_CHANGE: {
|
|
|
|
return {
|
|
|
|
...state,
|
2017-05-23 23:06:01 +00:00
|
|
|
nodeSelection: action.value
|
2017-04-14 06:25:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|