initial commit
This commit is contained in:
1 parent
7cb985116e
commit
75acf7b38f
955 files changed
+37333
-87054
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { notificationChannelSchema } from "@/validation/zod";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { z } from "zod";
|
||||
export const useInitForm = ({
|
||||
initialData,
|
||||
}: {
|
||||
initialData: Partial<z.infer<typeof notificationChannelSchema>> | undefined;
|
||||
}) => {
|
||||
return useMemo(() => {
|
||||
const defaults: z.infer<typeof notificationChannelSchema> = {
|
||||
name: initialData?.name || "",
|
||||
type: initialData?.type || "email",
|
||||
config: {
|
||||
url: initialData?.config?.url || "",
|
||||
emailAddress: initialData?.config?.emailAddress || "",
|
||||
},
|
||||
};
|
||||
return { defaults };
|
||||
}, [initialData]);
|
||||
};
|
||||
Reference in new issue
Block a user