diff --git a/src/api/ai-roadmap.ts b/src/api/ai-roadmap.ts index 89610ec8d..944b120ed 100644 --- a/src/api/ai-roadmap.ts +++ b/src/api/ai-roadmap.ts @@ -6,6 +6,7 @@ export type GetAIRoadmapBySlugResponse = { term: string; title: string; data: string; + isAuthenticatedUser: boolean; }; export function aiRoadmapApi(context: APIContext) { diff --git a/src/components/GenerateRoadmap/GenerateRoadmap.tsx b/src/components/GenerateRoadmap/GenerateRoadmap.tsx index d7a36236e..e675fa2a1 100644 --- a/src/components/GenerateRoadmap/GenerateRoadmap.tsx +++ b/src/components/GenerateRoadmap/GenerateRoadmap.tsx @@ -91,10 +91,15 @@ type GetAIRoadmapResponse = { type GenerateRoadmapProps = { roadmapId?: string; slug?: string; + isAuthenticatedUser?: boolean; }; export function GenerateRoadmap(props: GenerateRoadmapProps) { - const { roadmapId: defaultRoadmapId, slug: defaultRoadmapSlug } = props; + const { + roadmapId: defaultRoadmapId, + slug: defaultRoadmapSlug, + isAuthenticatedUser = isLoggedIn(), + } = props; const roadmapContainerRef = useRef(null); @@ -130,7 +135,6 @@ export function GenerateRoadmap(props: GenerateRoadmapProps) { getOpenAIKey(), ); const isKeyOnly = IS_KEY_ONLY_ROADMAP_GENERATION; - const isAuthenticatedUser = isLoggedIn(); const renderRoadmap = async (roadmap: string) => { const { nodes, edges } = generateAIRoadmapFromText(roadmap); diff --git a/src/pages/ai/[aiRoadmapSlug].astro b/src/pages/ai/[aiRoadmapSlug].astro index faf8464b7..d37723669 100644 --- a/src/pages/ai/[aiRoadmapSlug].astro +++ b/src/pages/ai/[aiRoadmapSlug].astro @@ -26,5 +26,9 @@ const title = roadmap?.title || 'Roadmap AI'; --- - +