Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Typography } from "@mui/material";
import { useMutation } from "@tanstack/react-query";
import Alert from "components/Alert";
import StyledLink from "components/StyledLink";
import { useAuthContext } from "features/auth/AuthProvider";
import { Trans, useTranslation } from "i18n";
import { AUTH, GLOBAL } from "i18n/namespaces";
import { useState } from "react";
import { service } from "service";
export default function ResendVerificationEmailForm() {
const { t } = useTranslation([AUTH, GLOBAL]);
const { authActions, authState } = useAuthContext();
const [resent, setResent] = useState<boolean>(false);
const mutation = useMutation({
mutationFn: async () => {
const state = await service.auth.signupFlowResendVerificationEmail(
authState.flowState!.flowToken,
);
authActions.updateSignupState(state);
setResent(true);
},
});
return (
<>
{mutation.error && (
<Alert severity="error">{mutation.error.message || ""}</Alert>
)}
<Typography variant="body1" gutterBottom>
{t("auth:sign_up_completed_prompt")}
</Typography>
<Typography variant="body1">
{!resent ? (
<Trans i18nKey="auth:sign_up_resend_verification_email_help">
Didn't receive the email? Click{" "}
<StyledLink
href="#"
onClick={(e) => {
e.preventDefault();
mutation.mutateAsync();
}}
>
here to resend the verification link
</StyledLink>
.
</Trans>
) : (
<>{t("auth:sign_up_resend_verification_done")}</>
)}
</Typography>
</>
);
}
|