Skip to content

Commit

Permalink
include epired courses
Browse files Browse the repository at this point in the history
  • Loading branch information
lumi-tip committed Dec 13, 2024
1 parent 795c95f commit 617d163
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common/store/actions/subscriptionAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const useSubscriptionsHandler = () => {
payload: true,
});
bc.payment({
status: 'ACTIVE,FREE_TRIAL,FULLY_PAID,CANCELLED,PAYMENT_ISSUE',
status: 'ACTIVE,FREE_TRIAL,FULLY_PAID,CANCELLED,PAYMENT_ISSUE,EXPIRED',
}).subscriptions()
.then(async ({ data }) => {
const subscriptionsDataWithPlanOffer = data?.subscriptions?.length > 0 ? await Promise.all(data?.subscriptions.map(async (s) => {
Expand Down
8 changes: 7 additions & 1 deletion src/pages/cohort/[cohortSlug]/[slug]/[version]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ function Dashboard() {
return;
}

const expiredCourse = cohortSubscriptions.find((sub) => sub.status === 'EXPIRED');
if (expiredCourse) {
showToastAndRedirect(currentCohortSlug);
return;
}

const fullyPaidSub = cohortSubscriptions.find((sub) => sub.status === 'FULLY_PAID' || sub.status === 'ACTIVE');
if (fullyPaidSub) {
setGrantAccess(true);
Expand Down Expand Up @@ -276,7 +282,7 @@ function Dashboard() {
});

bc.payment({
status: 'ACTIVE,FREE_TRIAL,FULLY_PAID,CANCELLED,PAYMENT_ISSUE',
status: 'ACTIVE,FREE_TRIAL,FULLY_PAID,CANCELLED,PAYMENT_ISSUE,EXPIRED',
}).subscriptions()
.then(async ({ data }) => {
const currentPlanFinancing = data?.plan_financings?.find((s) => s?.selected_cohort_set?.cohorts.some((cohort) => cohort?.slug === cohortSlug));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function SyllabusContent() {

useEffect(() => {
bc.payment({
status: 'ACTIVE,FREE_TRIAL,FULLY_PAID,CANCELLED,PAYMENT_ISSUE',
status: 'ACTIVE,FREE_TRIAL,FULLY_PAID,CANCELLED,PAYMENT_ISSUE,EXPIRED',
}).subscriptions()
.then(async ({ data }) => {
const planFinancings = data?.plan_financings?.length > 0 ? data?.plan_financings : [];
Expand Down Expand Up @@ -309,6 +309,12 @@ function SyllabusContent() {
return;
}

const expiredCourse = cohortSubscriptions.find((sub) => sub.status === 'EXPIRED');
if (expiredCourse) {
showToastAndRedirect(currentCohortSlug);
return;
}

const fullyPaidSub = cohortSubscriptions.find((sub) => sub.status === 'FULLY_PAID' || sub.status === 'ACTIVE');
if (fullyPaidSub) {
setGrantAccess(true);
Expand Down

0 comments on commit 617d163

Please sign in to comment.