[WEB-2289] fix: email notification settings form validation (#5413)
* fix: email notification validation * chore: code refactor
This commit is contained in:
parent
460003c7f5
commit
48e9042970
1 changed files with 2 additions and 6 deletions
|
|
@ -21,11 +21,9 @@ export const EmailNotificationForm: FC<IEmailNotificationFormProps> = (props) =>
|
|||
// form data
|
||||
const {
|
||||
handleSubmit,
|
||||
watch,
|
||||
control,
|
||||
setValue,
|
||||
reset,
|
||||
formState: { isSubmitting, isDirty, dirtyFields },
|
||||
formState: { isSubmitting, dirtyFields },
|
||||
} = useForm<IUserEmailNotificationSettings>({
|
||||
defaultValues: {
|
||||
...data,
|
||||
|
|
@ -93,9 +91,7 @@ export const EmailNotificationForm: FC<IEmailNotificationFormProps> = (props) =>
|
|||
render={({ field: { value, onChange } }) => (
|
||||
<Checkbox
|
||||
checked={value}
|
||||
indeterminate={!value && watch("issue_completed")}
|
||||
onChange={() => {
|
||||
setValue("issue_completed", !value, { shouldDirty: true });
|
||||
onChange(!value);
|
||||
}}
|
||||
containerClassName="mx-2"
|
||||
|
|
@ -155,7 +151,7 @@ export const EmailNotificationForm: FC<IEmailNotificationFormProps> = (props) =>
|
|||
</div>
|
||||
</div>
|
||||
<div className="flex items-center py-12">
|
||||
<Button variant="primary" onClick={handleSubmit(onSubmit)} loading={isSubmitting} disabled={!isDirty}>
|
||||
<Button variant="primary" onClick={handleSubmit(onSubmit)} loading={isSubmitting}>
|
||||
{isSubmitting ? "Saving..." : "Save changes"}
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue