mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
refactoring some files.
This commit is contained in:
@@ -7,6 +7,8 @@ import {Button} from "@/components/ui/button";
|
||||
import {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from "@/components/ui/form";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {OrganizationSchema} from "@/components/wrappers/dashboard/organization/organization.schema";
|
||||
import {createOrganizationAction} from "@/components/wrappers/dashboard/organization/organization.action";
|
||||
import {useRouter} from "next/navigation";
|
||||
|
||||
export type createOrganizationModalProps = {
|
||||
children: any
|
||||
@@ -17,12 +19,16 @@ export function CreateOrganizationModal(props: createOrganizationModalProps) {
|
||||
|
||||
const {children} = props;
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const form = useZodForm({
|
||||
schema: OrganizationSchema,
|
||||
});
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (values: OrganizationSchema) => {
|
||||
const result = await createOrganizationAction(values)
|
||||
router.refresh()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -61,6 +67,20 @@ export function CreateOrganizationModal(props: createOrganizationModalProps) {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="slug"
|
||||
defaultValue=""
|
||||
render={({field}) => (
|
||||
<FormItem>
|
||||
<FormLabel>Slug</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage/>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user