fix: redirect users to success url after /donation completion (#39404)

This commit is contained in:
Ahmad Abdolsaheb
2020-08-19 22:50:34 +03:00
committed by GitHub
parent fc1200ae2c
commit 0ee680c3ab
2 changed files with 15 additions and 4 deletions

View File

@@ -19,7 +19,8 @@ import {
durationsConfig,
defaultAmount,
defaultStateConfig,
onetimeSKUConfig
onetimeSKUConfig,
donationUrls
} from '../../../../config/donation-settings';
import { deploymentEnv } from '../../../config/env.json';
import Spacer from '../helpers/Spacer';
@@ -95,6 +96,9 @@ class DonateForm extends Component {
error: error
}
}));
if (success) {
this.props.navigate(donationUrls.successUrl);
}
}
getActiveDonationAmount(durationSelected, amountSelected) {
@@ -159,8 +163,8 @@ class DonateForm extends Component {
};
const { error } = await stripe.redirectToCheckout({
items: [item],
successUrl: 'https://www.freecodecamp.org/news/thank-you-for-donating/',
cancelUrl: 'https://freecodecamp.org/donate'
successUrl: donationUrls.successUrl,
cancelUrl: donationUrls.cancelUrl
});
console.error(error);
}