diff --git a/src/components/Dashboard/Ratings/index.tsx b/src/components/Dashboard/Ratings/index.tsx index 32b338e9..e4d2aef5 100644 --- a/src/components/Dashboard/Ratings/index.tsx +++ b/src/components/Dashboard/Ratings/index.tsx @@ -26,8 +26,14 @@ export const DashboardComponent: React.FC = () => { useEffect(() => { const fetchCourses = async () => { + const userIds = initialState?.currentUser?.id; const request = await course({ - authors: initialState?.currentUser?.id, + authors: + Array.isArray(userIds) && typeof userIds[0] === 'number' + ? userIds + : typeof userIds === 'number' + ? [userIds] + : undefined, }); if (request.success) { diff --git a/src/components/Dashboard/YourCourses/index.tsx b/src/components/Dashboard/YourCourses/index.tsx index d233948c..1cf7d606 100644 --- a/src/components/Dashboard/YourCourses/index.tsx +++ b/src/components/Dashboard/YourCourses/index.tsx @@ -19,8 +19,14 @@ export const DashboardComponent: React.FC = () => { useEffect(() => { const fetchCourses = async () => { + const userIds = initialState?.currentUser?.id; const request = await course({ - authors: initialState?.currentUser?.id, + authors: + Array.isArray(userIds) && typeof userIds[0] === 'number' + ? userIds + : typeof userIds === 'number' + ? [userIds] + : undefined, // Default get courses by latest order: 'DESC', order_by: 'created_at',