Skip to content

Commit f9949cc

Browse files
committed
get callbackId from url
1 parent 0819f93 commit f9949cc

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/app/Auth/ResetPassword.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState, FC } from "react"
22
import * as Yup from "yup"
33
import { Alert, Button } from "antd"
4-
import { useHistory, useLocation } from "react-router"
4+
import { useHistory, useLocation, useParams } from "react-router"
55
import { Formik, FormikProps, Form } from "formik"
66

77
import { LOGIN } from "routes"
@@ -20,12 +20,9 @@ export type FormValues = {
2020

2121
export const ResetPassword: FC = () => {
2222
const history = useHistory()
23-
const queryParams = new URLSearchParams(useLocation().search)
24-
const callbackId = queryParams.get("callbackId") || ""
23+
const { callbackId } = useParams<{ callbackId: string }>()
2524
const [matchError, setMatchError] = useState<boolean>(false)
2625

27-
console.log(callbackId)
28-
2926
return (
3027
<Formik
3128
initialValues={{
@@ -53,13 +50,8 @@ export const ResetPassword: FC = () => {
5350
})}
5451
>
5552
{(props: FormikProps<FormValues>) => {
56-
const {
57-
values,
58-
errors,
59-
setFieldValue,
60-
submitCount,
61-
isSubmitting,
62-
} = props
53+
const { values, errors, setFieldValue, submitCount, isSubmitting } =
54+
props
6355
const wasSubmitted = submitCount > 0
6456
setMatchError(
6557
wasSubmitted && values.password !== values.confirmPassword

0 commit comments

Comments
 (0)