mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: fixes broken nonePage.tsx
This commit is contained in:
@@ -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<typeof schema>;
|
||||
|
||||
export const NonePage = () => {
|
||||
const { createNotification } = useNotificationContext();
|
||||
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
|
||||
"createOrg",
|
||||
] as const);
|
||||
|
||||
const { mutateAsync } = useCreateOrg();
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
reset,
|
||||
formState: { isSubmitting }
|
||||
} = useForm<FormData>({
|
||||
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 (
|
||||
<div className="flex h-full w-full justify-center bg-bunker-800 text-white">
|
||||
|
||||
Reference in New Issue
Block a user