Skip to content

Commit

Permalink
use is submitting instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-justin committed Jan 11, 2024
1 parent bfde6d6 commit 112d2ef
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/Admin/Charity/Members/AddForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type Props = {
};

export default function AddForm({ added, endowID }: Props) {
const [addAdmin, { isLoading }] = useNewEndowAdminMutation();
const [addAdmin] = useNewEndowAdminMutation();
const [profile] = useLazyProfileQuery();
const { setModalOption, showModal } = useModalContext();
const methods = useForm({
Expand All @@ -36,7 +36,10 @@ export default function AddForm({ added, endowID }: Props) {
});

type FV = typeof methods extends UseFormReturn<infer U> ? U : never;
const { handleSubmit } = methods;
const {
handleSubmit,
formState: { isSubmitting },
} = methods;

const submit: SubmitHandler<FV> = async (fv) => {
try {
Expand Down Expand Up @@ -83,7 +86,7 @@ export default function AddForm({ added, endowID }: Props) {
<Field<FV> name="firstName" label="First name" required />
<Field<FV> name="lastName" label="Last name" required />
</FormProvider>
<button disabled={isLoading} type="submit" className="btn-orange mt-6">
<button disabled={isSubmitting} type="submit" className="btn-orange mt-6">
Add member
</button>
</Modal>
Expand Down

0 comments on commit 112d2ef

Please sign in to comment.