feat/ai-courses
Arik Chakma 2 months ago
parent 3e83d9a949
commit 9a27b670da
  1. 6
      src/components/GenerateCourse/AICourseContent.tsx

@ -176,6 +176,7 @@ export function AICourseContent(props: AICourseContentProps) {
if (!reader) { if (!reader) {
console.error('Failed to get reader from response'); console.error('Failed to get reader from response');
setError('Something went wrong');
setIsLoading(false); setIsLoading(false);
return; return;
} }
@ -263,7 +264,8 @@ export function AICourseContent(props: AICourseContentProps) {
setIsLoading(false); setIsLoading(false);
}, },
}); });
} catch (error) { } catch (error: any) {
setError(error?.message || 'Something went wrong');
console.error('Error in course generation:', error); console.error('Error in course generation:', error);
setIsLoading(false); setIsLoading(false);
} }
@ -352,7 +354,7 @@ export function AICourseContent(props: AICourseContentProps) {
const totalModules = streamedCourse.modules.length; const totalModules = streamedCourse.modules.length;
const totalLessons = currentModule?.lessons.length || 0; const totalLessons = currentModule?.lessons.length || 0;
if (error ) { if (error && !isLoading) {
return ( return (
<div className="flex h-screen flex-col items-center justify-center px-4 text-center"> <div className="flex h-screen flex-col items-center justify-center px-4 text-center">
<ErrorIcon additionalClasses="h-24 w-24" /> <ErrorIcon additionalClasses="h-24 w-24" />

Loading…
Cancel
Save