bd79b7ed14
- Add support for initial data in all marketing wizard step components - Update step presenters to accept and handle initial data - Modify forwardRef implementations to include initialData prop - Add TypeScript interfaces for step component props - Improve type safety and data handling across marketing wizard steps - Prepare components for edit and create workflows with consistent data management
40 lines
689 B
TypeScript
40 lines
689 B
TypeScript
import { useForm } from "react-hook-form";
|
|
|
|
interface FooterFormValues {
|
|
email: string;
|
|
phone: string;
|
|
location: string;
|
|
tagline: string;
|
|
copyright: string;
|
|
}
|
|
|
|
const useFooterStepPresenter = (initialData?: FooterFormValues) => {
|
|
const {
|
|
register,
|
|
handleSubmit,
|
|
formState: { errors },
|
|
getValues,
|
|
} = useForm<FooterFormValues>({
|
|
defaultValues: initialData,
|
|
});
|
|
|
|
const onSubmit = (data: FooterFormValues) => {
|
|
console.log(data);
|
|
};
|
|
|
|
const collectData = async () => {
|
|
return getValues();
|
|
};
|
|
|
|
return {
|
|
register,
|
|
handleSubmit,
|
|
onSubmit,
|
|
errors,
|
|
collectData,
|
|
getValues,
|
|
};
|
|
};
|
|
|
|
export default useFooterStepPresenter;
|