| 36 | }; |
| 37 | |
| 38 | export const userReducer = (state = initialState, action = {}) => { |
| 39 | switch (action.type) { |
| 40 | case GET_USER.PENDING: |
| 41 | return { |
| 42 | ...state, |
| 43 | isPendingUser: true, |
| 44 | }; |
| 45 | case GET_USER.SUCCESS: |
| 46 | return { |
| 47 | ...state, |
| 48 | user: action.payload, |
| 49 | isPendingUser: false, |
| 50 | }; |
| 51 | case GET_USER.ERROR: |
| 52 | return { |
| 53 | ...state, |
| 54 | error: action.payload, |
| 55 | isPendingUser: false, |
| 56 | }; |
| 57 | case GET_ORGS.PENDING: |
| 58 | return { |
| 59 | ...state, |
| 60 | isPendingOrgs: true, |
| 61 | }; |
| 62 | case GET_ORGS.SUCCESS: |
| 63 | return { |
| 64 | ...state, |
| 65 | orgs: action.payload, |
| 66 | isPendingOrgs: false, |
| 67 | }; |
| 68 | case GET_ORGS.ERROR: |
| 69 | return { |
| 70 | ...state, |
| 71 | error: action.payload, |
| 72 | isPendingOrgs: false, |
| 73 | }; |
| 74 | case GET_STAR_COUNT.PENDING: |
| 75 | return { |
| 76 | ...state, |
| 77 | isPendingStarCount: true, |
| 78 | }; |
| 79 | case GET_STAR_COUNT.SUCCESS: |
| 80 | return { |
| 81 | ...state, |
| 82 | starCount: action.payload, |
| 83 | isPendingStarCount: false, |
| 84 | }; |
| 85 | case GET_STAR_COUNT.ERROR: |
| 86 | return { |
| 87 | ...state, |
| 88 | error: action.payload, |
| 89 | isPendingStarCount: false, |
| 90 | }; |
| 91 | case GET_IS_FOLLOWING.PENDING: |
| 92 | return { |
| 93 | ...state, |
| 94 | isPendingCheckFollowing: true, |
| 95 | }; |