diff options
author | Dessalines <tyhou13@gmx.com> | 2020-07-11 19:12:56 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-07-11 19:12:56 -0400 |
commit | 60288b2d060ba930fe6cae22c4824d88fe7a00c9 (patch) | |
tree | 8fed01325853240c69f3688ee621be29bedfd382 /ui/src/components/password_change.tsx | |
parent | 1710844a1bc6a4f46eceaa12f2fb428cb794c694 (diff) | |
parent | 1b9f2fa5f7f7831f59b24cb36a5607a769a0d92e (diff) |
Merge branch 'master' into jmarthernandez-remove-karma-from-search
Diffstat (limited to 'ui/src/components/password_change.tsx')
-rw-r--r-- | ui/src/components/password_change.tsx | 25 |
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}`; } } } |