Fixed default plan for complimentary members

refs https://github.com/TryGhost/members.js/issues/77

- Fixes members on complimentary plan not having a default plan selected on account plan page
This commit is contained in:
Rish 2020-09-03 17:13:38 +05:30
parent a8d2c03f9c
commit b563ab05a9

View File

@ -90,8 +90,11 @@ export default class AccountPlanPage extends React.Component {
const {member} = this.context;
const {plans} = this.context.site;
this.plans = this.getPlansData({plans});
const activePlan = this.getActivePlanName({member}) || this.plans[0].name;
let activePlan = this.getActivePlanName({member}) || this.plans[0].name;
const activePlanExists = this.plans.some(d => d.name === activePlan);
if (!activePlanExists) {
activePlan = this.plans[0].name;
}
this.state = {
plan: activePlan
};