diff options
author | Dessalines <tyhou13@gmx.com> | 2020-01-23 19:17:42 -0500 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-01-23 19:17:42 -0500 |
commit | ac1d5f2b86b0816cc9b5794dc6c38a38365ed839 (patch) | |
tree | bedaab04ca797113990e5702cad36f5e34e9e6e8 /ui/src/components/password_change.tsx | |
parent | 39d1fb4450cb418d9c11b31ea99484c2a177fab6 (diff) | |
parent | b45c83682c187737b092080e83ba741c39cfa695 (diff) |
Done merging http-api and private_message
Diffstat (limited to 'ui/src/components/password_change.tsx')
-rw-r--r-- | ui/src/components/password_change.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/src/components/password_change.tsx b/ui/src/components/password_change.tsx index 76b4fb01..10b6867c 100644 --- a/ui/src/components/password_change.tsx +++ b/ui/src/components/password_change.tsx @@ -5,9 +5,10 @@ import { UserOperation, LoginResponse, PasswordChangeForm, + WebSocketJsonResponse, } from '../interfaces'; import { WebSocketService, UserService } from '../services'; -import { msgOp, capitalizeFirstLetter, toast } from '../utils'; +import { wsJsonToRes, capitalizeFirstLetter, toast } from '../utils'; import { i18n } from '../i18next'; import { T } from 'inferno-i18next'; @@ -133,19 +134,19 @@ export class PasswordChange extends Component<any, State> { WebSocketService.Instance.passwordChange(i.state.passwordChangeForm); } - parseMessage(msg: any) { - let op: UserOperation = msgOp(msg); + parseMessage(msg: WebSocketJsonResponse) { + let res = wsJsonToRes(msg); if (msg.error) { toast(i18n.t(msg.error), 'danger'); this.state.loading = false; this.setState(this.state); return; } else { - if (op == UserOperation.PasswordChange) { + if (res.op == UserOperation.PasswordChange) { + let data = res.data as LoginResponse; this.state = this.emptyState; this.setState(this.state); - let res: LoginResponse = msg; - UserService.Instance.login(res); + UserService.Instance.login(data); this.props.history.push('/'); } } |