Skip to content

Commit

Permalink
add Back button
Browse files Browse the repository at this point in the history
  • Loading branch information
vikibrezinova committed Nov 12, 2023
1 parent 1f2be85 commit 3a395fd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/components/Profile/ProfileForm.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {Stack, Typography} from '@mui/material'
import {useMutation, useQuery} from '@tanstack/react-query'
import axios from 'axios'
import {useRouter} from 'next/router'
Expand Down Expand Up @@ -96,6 +97,10 @@ export const ProfileForm: FC = () => {
submitFormData(data)
}

const returnBack = () => {
router.push(`/${seminar}/profil`)
}

const requiredRule = {required: '* Toto pole nemôže byť prázdne.'}
const phoneRule = {
validate: (val?: string) => {
Expand All @@ -112,9 +117,14 @@ export const ProfileForm: FC = () => {
<FormInput control={control} name="phone" label="telefónne číslo" rules={phoneRule} />
<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>
<Button type="submit" onClick={scrollToTop}>
Uložiť údaje
</Button>
<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>
</Stack>
</form>
</div>
)
Expand Down

0 comments on commit 3a395fd

Please sign in to comment.