Last active
August 9, 2018 18:20
-
-
Save MacgyverMartins/c95678b3a0afbd88c0c0a5949cc8fea2 to your computer and use it in GitHub Desktop.
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 someAPI from '../services/someAPI'; | |
export const GET_CUSTOMER = 'GET_CUSTOMER'; | |
export const getCustomer = customerId => ({ | |
type: GET_CUSTOMERS, | |
payload: someAPI.get(`customers/${customerId}`) | |
}); |
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 { 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