Skip to content

Instantly share code, notes, and snippets.

@Ayyagaries
Last active April 2, 2018 20:33
Show Gist options
  • Save Ayyagaries/fb85a0dff84db3ae862dd68f61b92a67 to your computer and use it in GitHub Desktop.
Save Ayyagaries/fb85a0dff84db3ae862dd68f61b92a67 to your computer and use it in GitHub Desktop.
Reducer
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