1 import { setIsoData } from "@utils/app";
2 import { Component } from "inferno";
3 import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client";
4 import { i18n } from "../../i18next";
5 import { HttpService, RequestState } from "../../services/HttpService";
6 import { toast } from "../../toast";
7 import { HtmlTags } from "../common/html-tags";
8 import { Spinner } from "../common/icon";
11 verifyRes: RequestState<VerifyEmailResponse>;
12 siteRes: GetSiteResponse;
15 export class VerifyEmail extends Component<any, State> {
16 private isoData = setIsoData(this.context);
19 verifyRes: { state: "empty" },
20 siteRes: this.isoData.site_res,
23 constructor(props: any, context: any) {
24 super(props, context);
29 verifyRes: { state: "loading" },
33 verifyRes: await HttpService.client.verifyEmail({
34 token: this.props.match.params.token,
38 if (this.state.verifyRes.state == "success") {
39 toast(i18n.t("email_verified"));
40 this.props.history.push("/login");
44 async componentDidMount() {
48 get documentTitle(): string {
49 return `${i18n.t("verify_email")} - ${
50 this.state.siteRes.site_view.site.name
56 <div className="verfy-email container-lg">
58 title={this.documentTitle}
59 path={this.context.router.route.match.url}
62 <div className="col-12 col-lg-6 offset-lg-3 mb-4">
63 <h5>{i18n.t("verify_email")}</h5>
64 {this.state.verifyRes.state == "loading" && (