Last active
September 13, 2016 07:37
-
-
Save marr/f7fd295ccc6efbb0eb30ca3056cc6ce0 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
| function setRefunderOnRefund(historyItem) { | |
| historyItem.refunds.forEach(async refund => { | |
| const { requesterId } = refund | |
| if (staff[requesterId]) { | |
| refund.requester = staff[requesterId] | |
| } else { | |
| const requester = await findStaffById(requesterId) | |
| refund.requester = (requester.firstName.charAt(0) + requester.lastName).toLowerCase() | |
| staff[requesterId] = refund.requester | |
| } | |
| }) | |
| return historyItem | |
| } |
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
| export function loadHistory({ personId }) { | |
| return async (dispatch) => { | |
| try { | |
| dispatch({ type: HISTORY_LOAD, payload: { personId } }) | |
| const { data, meta } = await secureFetch(endpoint) | |
| const purchaseHistory = camelify(data) | |
| .map(await setRefunderOnRefund) | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment