mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: safecheck code
This commit is contained in:
parent
4b623ae1b8
commit
977008f0ae
21 changed files with 234 additions and 151 deletions
32
front/pages/org/[orgslug]/course/[courseid].tsx
Normal file
32
front/pages/org/[orgslug]/course/[courseid].tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { useRouter } from "next/router";
|
||||
import React from "react";
|
||||
import Layout from "../../../../components/ui/layout";
|
||||
import { getCourse } from "../../../../services/courses";
|
||||
import { getOrganizationContextInfo } from "../../../../services/orgs";
|
||||
|
||||
const CourseIdPage = () => {
|
||||
const router = useRouter();
|
||||
const { courseid } = router.query;
|
||||
const { orgslug } = router.query;
|
||||
|
||||
const [isLoading, setIsLoading] = React.useState(true);
|
||||
const [courseInfo, setCourseInfo] = React.useState("") as any;
|
||||
|
||||
async function fetchCourseInfo() {
|
||||
const orgid = await getOrganizationContextInfo(orgslug);
|
||||
const response = await getCourse(courseid, orgid);
|
||||
const data = await response.json();
|
||||
setCourseInfo(data);
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (router.isReady) {
|
||||
fetchCourseInfo();
|
||||
}
|
||||
}, [isLoading, router.isReady]);
|
||||
|
||||
return <Layout>{isLoading ? <div>Loading...</div> : <div>{courseInfo.name}</div>}</Layout>;
|
||||
};
|
||||
|
||||
export default CourseIdPage;
|
||||
Loading…
Add table
Add a link
Reference in a new issue