Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MacgyverMartins
Last active August 9, 2018 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MacgyverMartins/c95678b3a0afbd88c0c0a5949cc8fea2 to your computer and use it in GitHub Desktop.
Save MacgyverMartins/c95678b3a0afbd88c0c0a5949cc8fea2 to your computer and use it in GitHub Desktop.
import someAPI from '../services/someAPI';
export const GET_CUSTOMER = 'GET_CUSTOMER';
export const getCustomer = customerId => ({
type: GET_CUSTOMERS,
payload: someAPI.get(`customers/${customerId}`)
});
import { GET_CUSTOMER } from '../actions/customers.actions';
const initialState = {
loading: false,
error: false,
detail: {}
};
export default (state = initialState, action) => {
switch (action.type) {
case `${GET_CUSTOMER}_FULFILLED`:
state.detail: action.payload.data
return state
// outros cases ...
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment