Merge branch 'main' into feat/create-multiple-orgs-under-same-account

This commit is contained in:
vmatsiiako
2023-10-16 18:55:48 -07:00
committed by GitHub
29 changed files with 484 additions and 104 deletions
+36 -1
View File
@@ -14,7 +14,42 @@ const schema = yup
export type FormData = yup.InferType<typeof schema>;
export const NonePage = () => {
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["createOrg"] as const);
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");