Skip to content

Commit

Permalink
feat(pass-reset): added functionality to pass reset dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeffer committed Dec 9, 2023
1 parent 1f5b665 commit 81c3757
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useRouter} from 'next/router'
import {FC, useState} from 'react'

import {Button} from '@/components/Clickable/Clickable'
Expand All @@ -10,6 +11,7 @@ export interface ILoginFormWrapper {
}

export const LoginFormWrapper: FC<ILoginFormWrapper> = ({closeOverlay}) => {
const router = useRouter()
const [form, changeForm] = useState('login')

if (form === 'login')
Expand All @@ -26,5 +28,11 @@ export const LoginFormWrapper: FC<ILoginFormWrapper> = ({closeOverlay}) => {
</>
)

return <PasswordResetRequestForm closeOverlay={closeOverlay} />
return (
<PasswordResetRequestForm
closeOverlay={() => {
router.push('/reset-verification-sent')
}}
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ export const PasswordResetRequestForm: FC<ILoginFormWrapper> = ({closeOverlay})
mutationFn: (data: PasswordResetRequestFormValues) => {
return axios.post<IGeneralPostResponse>('/api/user/password/reset/', data)
},

onError: (error, variables, context) => {},

onSuccess: () => {
closeOverlay()
},
})

const onSubmit: SubmitHandler<PasswordResetRequestFormValues> = (data) => {
Expand Down
15 changes: 15 additions & 0 deletions src/pages/malynar/reset-verification-sent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {NextPage} from 'next'

import {Verification} from '@/components/Verification/Verification'

import {PageLayout} from '../../../components/PageLayout/PageLayout'

const PasswordResetRequest: NextPage = () => {
return (
<PageLayout title="Reset hesla" contentWidth={2}>
<Verification />
</PageLayout>
)
}

export default PasswordResetRequest
15 changes: 15 additions & 0 deletions src/pages/matik/reset-verification-sent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {NextPage} from 'next'

import {Verification} from '@/components/Verification/Verification'

import {PageLayout} from '../../../components/PageLayout/PageLayout'

const PasswordResetRequest: NextPage = () => {
return (
<PageLayout title="Reset hesla" contentWidth={2}>
<Verification />
</PageLayout>
)
}

export default PasswordResetRequest
15 changes: 15 additions & 0 deletions src/pages/strom/reset-verification-sent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {NextPage} from 'next'

import {Verification} from '@/components/Verification/Verification'

import {PageLayout} from '../../../components/PageLayout/PageLayout'

const PasswordResetRequest: NextPage = () => {
return (
<PageLayout title="Reset hesla" contentWidth={2}>
<Verification />
</PageLayout>
)
}

export default PasswordResetRequest

0 comments on commit 81c3757

Please sign in to comment.