Created
August 29, 2016 23:29
-
-
Save ccorcos/8a1e52c4474b4f0385eb43b2af02b1db to your computer and use it in GitHub Desktop.
This file contains 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 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