Skip to content

Commit

Permalink
fix(client): donation-error-handler (freeCodeCamp#52517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirajn2311 authored Jan 9, 2024
1 parent 77fc745 commit 09e1fda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/redux/donation-saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export function* postChargeSaga({
}

if (paymentProvider === PaymentProvider.Stripe) {
yield call(postChargeStripe, payload);
const response = yield call(postChargeStripe, payload);
const error = response?.data?.error;
if (error) {
throw error;
}
} else if (paymentProvider === PaymentProvider.StripeCard) {
const optimizedPayload = { paymentMethodId, amount, duration };
const response = yield call(postChargeStripeCard, optimizedPayload);
Expand Down

0 comments on commit 09e1fda

Please sign in to comment.