fix(FormFooter, useCreateCustomerPresenter): disable submit button during mutation
- Added a disabled state to the submit button in FormFooter to prevent multiple submissions while a mutation is in progress. - Included a blank line in useCreateCustomerPresenter for improved code readability.
This commit is contained in:
@@ -31,6 +31,7 @@ const useCreateCustomerPresenter = ({
|
||||
mode: "onChange",
|
||||
defaultValues,
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const { mutate: createCustomer, isPending: isCreating } = useCreateCustomer();
|
||||
const { mutate: updateCustomer, isPending: isUpdating } = useUpdateCustomer(
|
||||
|
||||
@@ -13,6 +13,7 @@ const FormFooter = ({ onCancel }: IProps) => {
|
||||
<div className="col-span-2 flex gap-6">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isMutating > 0}
|
||||
className="mt-6 flex w-fit items-center justify-center rounded-lg bg-primary p-[13px] font-medium text-white hover:bg-opacity-90"
|
||||
>
|
||||
{isMutating ? (
|
||||
|
||||
Reference in New Issue
Block a user