From 445505cb6532d65585bfe2a545611b3b057f5d23 Mon Sep 17 00:00:00 2001 From: krishhh16 Date: Sun, 17 Mar 2024 15:30:10 +0530 Subject: [PATCH] closes #212 --- src/app/courses/[...courseId]/page.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/courses/[...courseId]/page.tsx b/src/app/courses/[...courseId]/page.tsx index bcd364bdf..37bdee0f8 100644 --- a/src/app/courses/[...courseId]/page.tsx +++ b/src/app/courses/[...courseId]/page.tsx @@ -14,6 +14,19 @@ import { redirect } from 'next/navigation'; import { CourseView } from '@/components/CourseView'; import { QueryParams } from '@/actions/types'; +interface PurchaseType { + id: number; + title: string; + imageUrl: string; + description: string; + appxCourseId: number; + openToEveryone: boolean; + slug: string; + discordRoleId: string; + totalVideos?: number; + totalVideosWatched: number; +} + const checkAccess = async (courseId: string) => { const session = await getServerSession(authOptions); @@ -21,7 +34,7 @@ const checkAccess = async (courseId: string) => { return false; } const purchases = await getPurchases(session.user.email); - if (purchases.map((p: any) => p.id).includes(Number(courseId))) { + if (purchases.map((p: PurchaseType) => p.id).includes(Number(courseId))) { return true; } return false;