- const form: PasswordChangeAfterReset = {
- token: i.state.form.token,
- password,
- password_verify,
- };
-
- WebSocketService.Instance.send(wsClient.passwordChange(form));
- }
- }
-
- parseMessage(msg: any) {
- const op = wsUserOp(msg);
- console.log(msg);
- if (msg.error) {
- toast(i18n.t(msg.error), "danger");
- this.setState({ loading: false });
- return;
- } else if (op == UserOperation.PasswordChangeAfterReset) {
- const data = wsJsonToRes<LoginResponse>(msg);
- UserService.Instance.login(data);
- this.props.history.push("/");
- location.reload();
+ i.setState({
+ passwordChangeRes: await HttpService.client.passwordChangeAfterReset({
+ token: i.state.form.token,
+ password,
+ password_verify,
+ }),
+ });
+
+ if (i.state.passwordChangeRes.state === "success") {
+ const data = i.state.passwordChangeRes.data;
+ UserService.Instance.login(data);
+
+ const site = await HttpService.client.getSite({ auth: myAuth() });
+ if (site.state === "success") {
+ UserService.Instance.myUserInfo = site.data.my_user;
+ }
+
+ this.props.history.replace("/");
+ }