|
1 | 1 | import { useTranslation } from "@prefabs.tech/react-i18n"; |
2 | 2 | import { AuthPage } from "@prefabs.tech/react-ui"; |
3 | 3 | import { useState } from "react"; |
| 4 | +import { useSearchParams } from "react-router-dom"; |
4 | 5 | import { toast } from "react-toastify"; |
5 | 6 |
|
| 7 | +import { ForgotPasswordForm } from "../components/ForgotPasswordForm"; |
| 8 | + |
6 | 9 | import { AuthLinks } from "@/components/AuthLinks"; |
7 | 10 | import { DEFAULT_PATHS } from "@/constants"; |
8 | 11 | import { useConfig } from "@/hooks"; |
9 | 12 | import { forgotPassword } from "@/supertokens"; |
10 | 13 | import { LinkType } from "@/types/types"; |
11 | 14 |
|
12 | | -import { ForgotPasswordForm } from "../components/ForgotPasswordForm"; |
13 | | - |
14 | 15 | export const ForgotPassword = ({ centered = true }: { centered?: boolean }) => { |
15 | 16 | const { t } = useTranslation("user"); |
16 | 17 | const [loading, setLoading] = useState<boolean>(false); |
17 | 18 |
|
| 19 | + const [searchParameters] = useSearchParams(); |
| 20 | + const email = searchParameters.get("email") ?? undefined; |
| 21 | + |
18 | 22 | const config = useConfig(); |
19 | 23 |
|
20 | 24 | const links: Array<LinkType> = [ |
@@ -43,7 +47,11 @@ export const ForgotPassword = ({ centered = true }: { centered?: boolean }) => { |
43 | 47 | className="forgot-password" |
44 | 48 | title={t("forgotPassword.title")} |
45 | 49 | > |
46 | | - <ForgotPasswordForm handleSubmit={handleSubmit} loading={loading} /> |
| 50 | + <ForgotPasswordForm |
| 51 | + handleSubmit={handleSubmit} |
| 52 | + loading={loading} |
| 53 | + email={email} |
| 54 | + /> |
47 | 55 | <AuthLinks className="forgot-password" links={links} /> |
48 | 56 | </AuthPage> |
49 | 57 | ); |
|
0 commit comments