diff --git a/src/components/CoursesList.tsx b/src/components/CoursesList.tsx index c00b2979..12db47a7 100644 --- a/src/components/CoursesList.tsx +++ b/src/components/CoursesList.tsx @@ -1,5 +1,4 @@ import React from "react"; -import { useHistory } from "@docusaurus/router"; import { useQuery } from "react-query"; import Tag from "@site/src/components/ui/Tag"; import { Skeleton } from "@site/src/components/ui/Skeleton"; @@ -7,6 +6,7 @@ import { getCourses } from "@site/src/api/course"; import { TCourse } from "../typings/course"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; import Translate from "@docusaurus/Translate"; +import Link from "@docusaurus/Link"; type TProps = { course: TCourse; @@ -14,42 +14,43 @@ type TProps = { const CourseCard = (props: TProps) => { const { course } = props; - const history = useHistory(); - const viewCourse = (path: string) => { + const courseRoutePath = (path: string) => { if (path.startsWith("http")) { - window.location.href = path; + return path; } else { - history.push(path); + return `/${path}`; } }; return ( -