(state = initialState, action)
| 44 | |
| 45 | // context reducer |
| 46 | export default function context(state = initialState, action) { |
| 47 | const { initialized } = state |
| 48 | const { type, campaign } = action |
| 49 | switch (type) { |
| 50 | case EVENTS.campaign: |
| 51 | return { |
| 52 | ...state, |
| 53 | ...{ campaign: campaign } |
| 54 | } |
| 55 | case EVENTS.offline: |
| 56 | return { |
| 57 | ...state, |
| 58 | ...{ offline: true } |
| 59 | } |
| 60 | case EVENTS.online: |
| 61 | return { |
| 62 | ...state, |
| 63 | ...{ offline: false } |
| 64 | } |
| 65 | default: |
| 66 | if (!initialized) { |
| 67 | return { |
| 68 | ...initialState, |
| 69 | ...state, |
| 70 | ...{ initialized: true } |
| 71 | } |
| 72 | } |
| 73 | return state |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | const excludeItems = ['plugins', 'reducers', 'storage'] |
| 78 | // Pull plugins and reducers off intital config |
nothing calls this directly
no outgoing calls
no test coverage detected