2016-06-29 12:27:04 +02:00
|
|
|
|
|
|
|
import { combineReducers } from 'redux'
|
2016-07-28 16:01:25 +02:00
|
|
|
import { SELECT_TAG, SELECT_VARIABLE, RESET_TAGS} from './actions'
|
2016-06-29 12:27:04 +02:00
|
|
|
|
2016-07-04 17:39:56 +02:00
|
|
|
function selectedTags(state = [], {type, tagName, tagValue}) {
|
|
|
|
switch (type) {
|
2016-06-29 12:27:04 +02:00
|
|
|
case SELECT_TAG:
|
2016-07-04 17:39:56 +02:00
|
|
|
return [...state, [tagName, tagValue]]
|
2016-07-28 16:01:25 +02:00
|
|
|
case RESET_TAGS:
|
|
|
|
return []
|
2016-06-29 12:27:04 +02:00
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-09 15:07:16 +02:00
|
|
|
function selectedVariable(state = null, {type, name}) {
|
2016-07-25 21:58:11 +02:00
|
|
|
switch (type) {
|
|
|
|
case SELECT_VARIABLE:
|
|
|
|
return name
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-12 20:03:54 +02:00
|
|
|
function rootVariables(state = ['cout du travail']) {
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
|
2016-06-29 12:27:04 +02:00
|
|
|
|
2016-07-04 17:28:30 +02:00
|
|
|
|
2016-06-29 12:27:04 +02:00
|
|
|
export default combineReducers({
|
2016-07-25 21:58:11 +02:00
|
|
|
selectedTags,
|
2016-08-12 20:03:54 +02:00
|
|
|
selectedVariable,
|
|
|
|
rootVariables
|
2016-06-29 12:27:04 +02:00
|
|
|
})
|