1 import { Component } from "inferno";
5 VerifyEmail as VerifyEmailForm,
8 } from "lemmy-js-client";
9 import { Subscription } from "rxjs";
10 import { i18n } from "../../i18next";
11 import { WebSocketService } from "../../services";
19 import { HtmlTags } from "../common/html-tags";
22 verifyEmailForm: VerifyEmailForm;
23 siteRes: GetSiteResponse;
26 export class VerifyEmail extends Component<any, State> {
27 private isoData = setIsoData(this.context);
28 private subscription?: Subscription;
32 token: this.props.match.params.token,
34 siteRes: this.isoData.site_res,
37 constructor(props: any, context: any) {
38 super(props, context);
40 this.parseMessage = this.parseMessage.bind(this);
41 this.subscription = wsSubscribe(this.parseMessage);
45 WebSocketService.Instance.send(
46 wsClient.verifyEmail(this.state.verifyEmailForm)
50 componentWillUnmount() {
52 this.subscription?.unsubscribe();
56 get documentTitle(): string {
57 return `${i18n.t("verify_email")} - ${
58 this.state.siteRes.site_view.site.name
64 <div className="container-lg">
66 title={this.documentTitle}
67 path={this.context.router.route.match.url}
70 <div className="col-12 col-lg-6 offset-lg-3 mb-4">
71 <h5>{i18n.t("verify_email")}</h5>
78 parseMessage(msg: any) {
79 let op = wsUserOp(msg);
82 toast(i18n.t(msg.error), "danger");
83 this.setState(this.state);
84 this.props.history.push("/");
86 } else if (op == UserOperation.VerifyEmail) {
87 let data = wsJsonToRes(msg);
89 toast(i18n.t("email_verified"));
90 this.props.history.push("/login");