(state, action)
| 1 | const githubReducer = (state, action) => { |
| 2 | switch (action.type) { |
| 3 | case 'GET_USERS': |
| 4 | return { |
| 5 | ...state, |
| 6 | users: action.payload, |
| 7 | loading: false, |
| 8 | } |
| 9 | case 'GET_USER_AND_REPOS': |
| 10 | return { |
| 11 | ...state, |
| 12 | user: action.payload.user, |
| 13 | repos: action.payload.repos, |
| 14 | loading: false, |
| 15 | } |
| 16 | case 'SET_LOADING': |
| 17 | return { |
| 18 | ...state, |
| 19 | loading: true, |
| 20 | } |
| 21 | case 'CLEAR_USERS': |
| 22 | return { |
| 23 | ...state, |
| 24 | users: [], |
| 25 | } |
| 26 | default: |
| 27 | return state |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export default githubReducer |
nothing calls this directly
no outgoing calls
no test coverage detected