Skip to content

Commit

Permalink
chore: use resetForm when closing dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhart1o1 committed Jan 13, 2025
1 parent 3e08e30 commit 221e51b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion apps/admin-panel/app/committees/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export const CreateCommitteeDialog: React.FC<CreateCommitteeDialogProps> = ({
openCreateCommitteeDialog,
}) => {
const { navigate, isNavigating } = useModalNavigation({
closeModal: () => setOpenCreateCommitteeDialog(false),
closeModal: () => {
setOpenCreateCommitteeDialog(false)
resetForm()
},
})

const [createCommittee, { loading, reset, error: createCommitteeError }] =
Expand Down
6 changes: 4 additions & 2 deletions apps/admin-panel/app/customers/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ export const CreateCustomerDialog: React.FC<CreateCustomerDialogProps> = ({
openCreateCustomerDialog,
}) => {
const { navigate, isNavigating } = useModalNavigation({
closeModal: () => setOpenCreateCustomerDialog(false),
closeModal: () => {
setOpenCreateCustomerDialog(false)
resetForm()
},
})

const [createCustomer, { loading, reset, error: createCustomerError }] =
Expand Down Expand Up @@ -203,7 +206,6 @@ export const CreateCustomerDialog: React.FC<CreateCustomerDialogProps> = ({
onCompleted: (data) => {
if (data?.customerCreate.customer) {
toast.success("Customer created successfully")
resetForm()
navigate(`/customers/${data.customerCreate.customer.customerId}`)
} else {
throw new Error("Failed to create customer. Please try again.")
Expand Down
5 changes: 4 additions & 1 deletion apps/admin-panel/app/terms-templates/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export const CreateTermsTemplateDialog: React.FC<CreateTermsTemplateDialogProps>
openCreateTermsTemplateDialog,
}) => {
const { navigate, isNavigating } = useModalNavigation({
closeModal: () => setOpenCreateTermsTemplateDialog(false),
closeModal: () => {
setOpenCreateTermsTemplateDialog(false)
resetForm()
},
})

const [createTermsTemplate, { loading, error: createTermsTemplateError }] =
Expand Down

0 comments on commit 221e51b

Please sign in to comment.