Skip to content

Commit

Permalink
add reset and change order of buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
vikibrezinova committed Nov 16, 2023
1 parent a6bcbd6 commit 359a024
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/components/Profile/PasswordChangeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export const PasswordChangeDialog: FC<PasswordChangeDialogProps> = ({open, close
submitFormData(data)
}

const onClose = () => {
reset()
close()
}

const requiredRule = {required: '* Toto pole nemôže byť prázdne.'}

return (
Expand Down Expand Up @@ -105,10 +110,10 @@ export const PasswordChangeDialog: FC<PasswordChangeDialogProps> = ({open, close
}
actions={
<>
<Button onClick={onClose}>Zavrieť</Button>
<Button type="submit" onClick={handleSubmit(onSubmit)}>
Potvrdiť
</Button>
<Button onClick={close}>Zavrieť</Button>
</>
}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Profile/ProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ export const ProfileForm: FC = () => {
<FormInput control={control} name="parent_phone" label="telefónne číslo na rodiča" rules={phoneRule} />
<p style={{fontWeight: 'bold'}}>* takto označéné polia sú povinné</p>
<Stack direction={'row'} mt={3} spacing={2}>
<Button type="submit" onClick={scrollToTop}>
<Typography variant="button2"> Uložiť údaje </Typography>
</Button>
<Button onClick={returnBack}>
<Typography variant="button2"> Späť </Typography>
</Button>
<Button type="submit" onClick={scrollToTop}>
<Typography variant="button2"> Uložiť údaje </Typography>
</Button>
</Stack>
</form>
</div>
Expand Down

0 comments on commit 359a024

Please sign in to comment.