From 619bbf2027a73eb59151831f43f27ca777646b95 Mon Sep 17 00:00:00 2001 From: Ronit Panda Date: Tue, 24 Oct 2023 06:09:12 +0530 Subject: [PATCH] fix: fixes broken nonePage.tsx --- frontend/src/views/Org/NonePage/NonePage.tsx | 52 +------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/frontend/src/views/Org/NonePage/NonePage.tsx b/frontend/src/views/Org/NonePage/NonePage.tsx index e2fd70fd2..9d6b4a65c 100644 --- a/frontend/src/views/Org/NonePage/NonePage.tsx +++ b/frontend/src/views/Org/NonePage/NonePage.tsx @@ -1,59 +1,9 @@ -import { useEffect } from "react"; -import * as yup from "yup"; - import { usePopUp } from "@app/hooks/usePopUp"; import { CreateOrgModal } from "../components"; -const schema = yup - .object({ - name: yup.string().required("Organization name is required") - }) - .required(); - -export type FormData = yup.InferType; - export const NonePage = () => { - const { createNotification } = useNotificationContext(); - const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([ - "createOrg", - ] as const); - - const { mutateAsync } = useCreateOrg(); - - const { - control, - handleSubmit, - reset, - formState: { isSubmitting } - } = useForm({ - resolver: yupResolver(schema), - defaultValues: { - name: "" - } - }); - - useEffect(() => { - handlePopUpOpen("createOrg"); - }, []); - - const onFormSubmit = async ({ name }: FormData) => { - try { - - const organization = await mutateAsync({ - name - }); - - localStorage.setItem("orgData.id", organization._id); - - createNotification({ - text: "Successfully created organization", - type: "success" - }); - - useEffect(() => { - handlePopUpOpen("createOrg"); - }, []); + const { popUp, handlePopUpToggle } = usePopUp(["createOrg"] as const); return (