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