diff --git a/front/app/_orgs/[orgslug]/(withmenu)/courses/new/page.tsx b/front/app/_orgs/[orgslug]/(withmenu)/courses/new/page.tsx deleted file mode 100644 index a615e102..00000000 --- a/front/app/_orgs/[orgslug]/(withmenu)/courses/new/page.tsx +++ /dev/null @@ -1,70 +0,0 @@ -"use client"; -import { useRouter } from "next/navigation"; -import React from "react"; -import { Title } from "@components/UI/Elements/Styles/Title"; -import { createNewCourse } from "@services/courses/courses"; -import { getOrganizationContextInfo } from "@services/organizations/orgs"; -import { getUriWithOrg } from "@services/config/config"; - -const NewCoursePage = (params: any) => { - const router = useRouter(); - const orgslug = params.params.orgslug; - const [name, setName] = React.useState(""); - const [description, setDescription] = React.useState(""); - const [isLoading, setIsLoading] = React.useState(false); - const [thumbnail, setThumbnail] = React.useState(null) as any; - const [orgId, setOrgId] = React.useState(null) as any; - - - const getOrgMetadata = async () => { - const org = await getOrganizationContextInfo(orgslug); - setOrgId(org.org_id); - } - - const handleNameChange = (event: React.ChangeEvent) => { - setName(event.target.value); - }; - - const handleDescriptionChange = (event: React.ChangeEvent) => { - setDescription(event.target.value); - }; - - const handleThumbnailChange = (event: React.ChangeEvent) => { - setThumbnail(event.target.files[0]); - }; - - const handleSubmit = async (e: any) => { - e.preventDefault(); - let status = await createNewCourse(orgId, { name, description }, thumbnail); - - // TODO : wow this is terrible - fix this - if (status.org_id == orgId) { - router.push(getUriWithOrg(orgslug, `/courses`)); - } else { - alert("Error creating course, please see console logs"); - console.log(status); - } - - }; - - React.useEffect(() => { - if (orgslug) { - getOrgMetadata(); - } - }, [isLoading, orgslug]); - - - return ( - <> - New Course -
- Name :
- Description :
- Cover Photo :
- Learnings (empty for now) (separated by ; ) :