fix null value error

This commit is contained in:
Nuwan 2024-04-05 11:11:13 +05:30
parent dbb5c4a520
commit 7b0d6c153e
1 changed files with 3 additions and 5 deletions

View File

@ -2,7 +2,6 @@ import React, { useEffect, useState, useRef } from 'react';
import { Card, CardHeader, CardBody, Label } from 'reactstrap';
import { useTranslation } from 'react-i18next';
import { formatDateShort } from '../../helpers/utils';
import { get } from 'react-hook-form';
function JKSubscriptionPlaytime({ userPlan, getDisplayName }) {
const { t } = useTranslation('account');
@ -87,8 +86,8 @@ function JKSubscriptionPlaytime({ userPlan, getDisplayName }) {
const effectivePlanName = planNameWithCycle(userPlan.plan_code);
const desiredPlanCode = userPlan.desired_plan_code;
const desiredPlanName = planNameWithCycle(desiredPlanCode);
const hasPendingSubscription = userPlan.subscription.pending_subscription;
const canceledSubscription = userPlan.subscription.remaining_billing_cycles === 0;
const hasPendingSubscription = userPlan.subscription?.pending_subscription;
const canceledSubscription = userPlan.subscription?.remaining_billing_cycles === 0;
if (adminOverride) {
expl = `You have a <strong>${effectivePlanName}</strong> account until your gifted plan ends ${formatDateShort(
@ -145,8 +144,7 @@ function JKSubscriptionPlaytime({ userPlan, getDisplayName }) {
if (userPlan.subscription.plan.plan_code !== userPlan.plan_code) {
billingAddendumTxt = ` You have paid only for the <strong>${planNameWithCycle(
userPlan.subscription.plan.plan_code
)}</strong> level for the current billing cycle, so there will be a change to the <strong>${this.planNameWithCycle(
this.props.subscription.subscription.pending_subscription.plan.plan_code
)}</strong> level for the current billing cycle, so there will be a change to the <strong>${this.planNameWithCycle(userPlan.subscription.pending_subscription.plan.plan_code
)}</strong> level on the next billing cycle.`;
} else {
billingAddendumTxt = ` And your plan and billing will switch to the <strong>${planNameWithCycle(