mirror of
https://github.com/betagouv/mon-entreprise
synced 2025-02-09 01:45:03 +00:00
Limitations : - Nous nous arrêtons quand la variable n'est pas trouvée, il faudrait utiliser l'API actuel - En fonction de la situation du state (variables d'input), il faut évaluer les conditions à la traversée du graphe pour éliminer les variables non appelables : rendre la traversée fainéante. Sinon : Introduction du mot clef 'exception' dans maladie pour le cas de l'Aslace Moselle agricole
35 lines
608 B
JavaScript
35 lines
608 B
JavaScript
|
|
import { combineReducers } from 'redux'
|
|
import { SELECT_TAG, SELECT_VARIABLE, RESET_TAGS} from './actions'
|
|
|
|
function selectedTags(state = [], {type, tagName, tagValue}) {
|
|
switch (type) {
|
|
case SELECT_TAG:
|
|
return [...state, [tagName, tagValue]]
|
|
case RESET_TAGS:
|
|
return []
|
|
default:
|
|
return state
|
|
}
|
|
}
|
|
|
|
function selectedVariable(state = null, {type, name}) {
|
|
switch (type) {
|
|
case SELECT_VARIABLE:
|
|
return name
|
|
default:
|
|
return state
|
|
}
|
|
}
|
|
|
|
function rootVariables(state = ['cout du travail']) {
|
|
return state
|
|
}
|
|
|
|
|
|
|
|
export default combineReducers({
|
|
selectedTags,
|
|
selectedVariable,
|
|
rootVariables
|
|
})
|