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 4x 10x 9x 9x 9x 4x 9x 5x 4x | import { Typography } from "@mui/material"; import Alert from "components/Alert"; import StyledLink from "components/StyledLink"; import { Empty } from "google-protobuf/google/protobuf/empty_pb"; import { RpcError } from "grpc-web"; import { useTranslation } from "i18n"; import { AUTH } from "i18n/namespaces"; import { useRouter } from "next/router"; import { useEffect } from "react"; import { useMutation } from "react-query"; import { loginRoute } from "routes"; import { service } from "service"; import stringOrFirstString from "utils/stringOrFirstString"; export default function ConfirmChangeEmail() { const { t } = useTranslation(AUTH); const router = useRouter(); const changeToken = stringOrFirstString(router.query.token); const { error, isLoading, isSuccess, mutate: confirmChangeEmail, } = useMutation<Empty, RpcError, string>((resetToken) => service.account.confirmChangeEmail(resetToken) ); useEffect(() => { if (changeToken) { confirmChangeEmail(changeToken); } }, [confirmChangeEmail, changeToken]); return isLoading ? ( <Typography variant="body1"> {t("change_email_confirmation.change_in_progress")} </Typography> ) : isSuccess ? ( <> <Alert severity="success"> {t("change_email_confirmation.success_message")} </Alert> <StyledLink href={loginRoute}>{t("login_prompt")}</StyledLink> </> ) : ( error && ( <Alert severity="error"> {t("change_email_confirmation.error_message", { message: error.message, })} </Alert> ) ); } |