summaryrefslogtreecommitdiffstats
path: root/ui/src/components/password_change.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/components/password_change.tsx')
-rw-r--r--ui/src/components/password_change.tsx25
1 files changed, 11 insertions, 14 deletions
diff --git a/ui/src/components/password_change.tsx b/ui/src/components/password_change.tsx
index 9445e8ed..f33e9af2 100644
--- a/ui/src/components/password_change.tsx
+++ b/ui/src/components/password_change.tsx
@@ -6,6 +6,7 @@ import {
LoginResponse,
PasswordChangeForm,
WebSocketJsonResponse,
+ GetSiteResponse,
} from '../interfaces';
import { WebSocketService, UserService } from '../services';
import { wsJsonToRes, capitalizeFirstLetter, toast } from '../utils';
@@ -40,18 +41,13 @@ export class PasswordChange extends Component<any, State> {
err => console.error(err),
() => console.log('complete')
);
+ WebSocketService.Instance.getSite();
}
componentWillUnmount() {
this.subscription.unsubscribe();
}
- componentDidMount() {
- document.title = `${i18n.t('password_change')} - ${
- WebSocketService.Instance.site.name
- }`;
- }
-
render() {
return (
<div class="container">
@@ -138,14 +134,15 @@ export class PasswordChange extends Component<any, State> {
this.state.loading = false;
this.setState(this.state);
return;
- } else {
- if (res.op == UserOperation.PasswordChange) {
- let data = res.data as LoginResponse;
- this.state = this.emptyState;
- this.setState(this.state);
- UserService.Instance.login(data);
- this.props.history.push('/');
- }
+ } else if (res.op == UserOperation.PasswordChange) {
+ let data = res.data as LoginResponse;
+ this.state = this.emptyState;
+ this.setState(this.state);
+ UserService.Instance.login(data);
+ this.props.history.push('/');
+ } else if (res.op == UserOperation.GetSite) {
+ let data = res.data as GetSiteResponse;
+ document.title = `${i18n.t('password_change')} - ${data.site.name}`;
}
}
}