mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 19:31:26 +00:00
wrap login call in try/catch for error handling
This commit is contained in:
parent
e0cc7ba3c3
commit
55512a2eae
1 changed files with 30 additions and 26 deletions
|
@ -160,6 +160,7 @@ export class Login extends Component<any, State> {
|
||||||
if (username_or_email && password) {
|
if (username_or_email && password) {
|
||||||
i.setState({ loginRes: { state: "loading" } });
|
i.setState({ loginRes: { state: "loading" } });
|
||||||
|
|
||||||
|
try {
|
||||||
const loginRes = await HttpService.client.login({
|
const loginRes = await HttpService.client.login({
|
||||||
username_or_email,
|
username_or_email,
|
||||||
password,
|
password,
|
||||||
|
@ -193,6 +194,9 @@ export class Login extends Component<any, State> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
i.setState({ loginRes: { state: "failed", msg: error.message } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue