aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/view.js
blob: 2b6fe67dd93fa9b87709674262a025611c382b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { SELECT_FLOW } from './flows'
const ACTIVE_MENU = 'ACTIVE_MENU'


const defaultState = {
    active_menu: 'Start'
}
export default function reducer(state = defaultState, action) {
    switch (action.type) {
        case ACTIVE_MENU:
            return {
                ...state,
                active_menu: action.active_menu
            }
        case SELECT_FLOW:
            return{
                ...state,
                active_menu: action.flowId ? 'Flow' : 'Start'
            }
        default:
            return state
    }
}

export function setActiveMenu(active_menu) {
    return {
        type: ACTIVE_MENU,
        active_menu
    }
}