Last active
April 2, 2018 20:33
-
-
Save Ayyagaries/fb85a0dff84db3ae862dd68f61b92a67 to your computer and use it in GitHub Desktop.
Reducer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RESPONSE_ADMIN_ATTACHED_FACILITIES, ERROR } from '../actions/pickFacility'; | |
const initialState = { | |
attachedFacilities: [], | |
msg: false, | |
isLoading: false, | |
}; | |
export default (state = initialState, action) => { | |
switch (action.type) { | |
case RESPONSE_ADMIN_ATTACHED_FACILITIES: | |
return { | |
...state, | |
attachedFacilities: action.attachedFacilities, | |
msg: false, | |
isLoading: false, | |
}; | |
case ERROR: | |
return { | |
...state, | |
msg: true, | |
attachedFacilities: [], | |
isLoading: false, | |
}; | |
default: { | |
return state; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment