Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Created August 29, 2016 23:29
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 ccorcos/8a1e52c4474b4f0385eb43b2af02b1db to your computer and use it in GitHub Desktop.
Save ccorcos/8a1e52c4474b4f0385eb43b2af02b1db to your computer and use it in GitHub Desktop.
export function makePayment(loanId, amount, paymentMethodId) {
return async dispatch => {
dispatch(makePaymentSent())
const response = await api.makePayment(loanId, amount, paymentMethodId)
dispatch(closeModal())
if (response.status !== 200) {
dispatch(makePaymentFailed(response.statusText))
} else {
const result = await response.json()
dispatch(makePaymentSuccess(result.data))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment