Skip to content

Commit

Permalink
final form
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrin2005 committed Dec 21, 2024
1 parent 3438758 commit 2557354
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import isEqual from "lodash/isEqual";
//loadish
import { useEffect, useMemo, useRef, useState } from "react";

import { Cancel, Submit } from "@/components/Common/ButtonV2";
Expand Down Expand Up @@ -62,13 +63,11 @@ const Form = <T extends FormDetails>({
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
event.stopPropagation();

if (validate) {
const errors = omitBy(validate(state.form), isEmpty) as FormErrors<T>;

if (Object.keys(errors).length) {
dispatch({ type: "set_errors", errors });

//
if (errors.$all) {
Notification.Error({ msg: errors.$all });
}
Expand Down

0 comments on commit 2557354

Please sign in to comment.