Skip to content

Commit

Permalink
Reset state and set enable form actions for add role sidebar.
Browse files Browse the repository at this point in the history
  • Loading branch information
Santosh Pisini committed Jan 29, 2024
1 parent 2409b0b commit 78f80fb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const CreateRolePanel = ({ visible, onClose }: CreateRolePanelProps) => {
const { mutate: createDatabaseRole, isLoading: isCreating } = useDatabaseRoleCreateMutation({
onSuccess: (res) => {
toast.success(`Successfully created new role: ${res.name}`)
onClose()
handleClose()
},
})

Expand All @@ -71,7 +71,7 @@ const CreateRolePanel = ({ visible, onClose }: CreateRolePanelProps) => {

const handleClose = () => {
onClose()
form.reset()
form.reset(initialValues)
}

return (
Expand All @@ -87,8 +87,8 @@ const CreateRolePanel = ({ visible, onClose }: CreateRolePanelProps) => {
<FormActions
form={formId}
isSubmitting={isCreating}
hasChanges={form.formState.isDirty}
handleReset={() => form.reset()}
hasChanges={true}
handleReset={handleClose}
/>
</div>
}
Expand Down

0 comments on commit 78f80fb

Please sign in to comment.