"use client";

import { useState } from "react";
import { useForm } from "react-hook-form";

const useRoleForm = () => {
  const [triggerAlert, setTriggerAlert] = useState(false);

  const {
    register,
    handleSubmit,
    watch,
    formState: { errors },
  } = useForm();

  const onSubmit = (data) => {
    setTriggerAlert(true);

    console.log("Submitted data:", data);
  };

  return {
    register,
    handleSubmit,
    watch,
    errors,
    onSubmit,
    triggerAlert,
    setTriggerAlert,
  };
};

export default useRoleForm;
