fix: redirect users to success url after /donation completion (#39404)
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -113,6 +113,12 @@ const paypalConfigurator = (donationAmount, donationDuration, paypalConfig) => {
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
const donationUrls = {
|
||||
successUrl: 'https://www.freecodecamp.org/news/thank-you-for-donating/',
|
||||
cancelUrl: 'https://freecodecamp.org/donate'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
durationsConfig,
|
||||
amountsConfig,
|
||||
@ -124,5 +130,6 @@ module.exports = {
|
||||
modalDefaultStateConfig,
|
||||
onetimeSKUConfig,
|
||||
paypalConfigTypes,
|
||||
paypalConfigurator
|
||||
paypalConfigurator,
|
||||
donationUrls
|
||||
};
|
||||
|
Reference in New Issue
Block a user