From f4d49488a90827d26e8c3efa43d6bd4ff5b6f9ab Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 10 Dec 2017 12:15:49 +0000 Subject: [PATCH] Handle loading inside the login form itself. --- src/LoginForm.tsx | 13 +++++++++---- src/Root.tsx | 11 ++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/LoginForm.tsx b/src/LoginForm.tsx index 99d464c..f896d90 100644 --- a/src/LoginForm.tsx +++ b/src/LoginForm.tsx @@ -4,7 +4,7 @@ import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; import Toggle from 'material-ui/Toggle'; -import { getPalette } from './App'; +import { getPalette } from './App'; import * as C from './Constants'; @@ -28,6 +28,7 @@ class LoginForm extends React.Component { props: { onSubmit: (username: string, password: string, encryptionPassword: string, serviceApiUrl: string) => void; + loading?: boolean; error?: Error; }; @@ -77,8 +78,6 @@ class LoginForm extends React.Component { return; } - this.setState({password: '', encryptionPassword: ''}); - this.props.onSubmit(username, password, encryptionPassword, server); } @@ -159,8 +158,14 @@ class LoginForm extends React.Component { onToggle={this.toggleAdvancedSettings} /> {advancedSettings} +
- +
diff --git a/src/Root.tsx b/src/Root.tsx index 2eb8a17..5be6fa5 100644 --- a/src/Root.tsx +++ b/src/Root.tsx @@ -5,7 +5,6 @@ import Paper from 'material-ui/Paper'; import SyncGate from './SyncGate'; import LoginForm from './LoginForm'; -import LoadingIndicator from './LoadingIndicator'; import { store, StoreState, CredentialsType, fetchCredentials } from './store'; @@ -24,9 +23,7 @@ class Root extends React.Component { } render() { - if (this.props.credentials.fetching) { - return (); - } else if (this.props.credentials.value === null) { + if (this.props.credentials.value === null) { const style = { holder: { margin: 'auto', @@ -37,7 +34,11 @@ class Root extends React.Component { return ( - + ); }