Add missing error on authentication

This commit is contained in:
Anthony Laibe 2018-10-19 10:59:30 +01:00 committed by Pascal Precht
parent 4ca753f38f
commit 02aea0506f
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
3 changed files with 18 additions and 17 deletions

View File

@ -24,6 +24,9 @@ class Login extends React.Component {
<div className="login-container d-flex flex-column-reverse flex-md-row">
<div className="login-layout-container-section flex-fill">
<h2>Login</h2>
{this.props.error &&
<p className="text-danger">{this.props.error}</p>
}
<div className="mt-4">
<form onSubmit={(e) => this.handleSubmit(e)}>
<div className="form-group">

View File

@ -75,25 +75,23 @@ class AppContainer extends Component {
}
}
render() {
let content;
renderBody() {
if (this.shouldRenderLogin()) {
content = <Login credentials={this.props.credentials} authenticate={this.props.authenticate} error={this.props.authenticationError} />;
} else {
content = <Layout location={this.props.location}
logout={this.props.logout}
toggleTheme={() => this.toggleTheme()}
currentTheme={this.props.theme}>
<React.Fragment>{routes}</React.Fragment>
</Layout>;
return <Login credentials={this.props.credentials} authenticate={this.props.authenticate} error={this.props.authenticationError} />;
}
return (
<div className={(this.props.theme) + "-theme"}>
{content}
</div>
<Layout location={this.props.location}
logout={this.props.logout}
toggleTheme={() => this.toggleTheme()}
currentTheme={this.props.theme}>
<React.Fragment>{routes}</React.Fragment>
</Layout>
);
}
render() {
return <div className={(this.props.theme) + "-theme"}>{this.renderBody()}</div>;
}
}
AppContainer.propTypes = {
@ -111,7 +109,7 @@ AppContainer.propTypes = {
location: PropTypes.object,
theme: PropTypes.string,
changeTheme: PropTypes.func,
fetchTheme: PropTypes.func
fetchTheme: PropTypes.func,
};
function mapStateToProps(state) {
@ -119,7 +117,7 @@ function mapStateToProps(state) {
initialized: getVersions(state).length > 0,
credentials: getCredentials(state),
authenticationError: getAuthenticationError(state),
theme: getTheme(state)
theme: getTheme(state),
};
}

View File

@ -14,7 +14,7 @@ function *doRequest(entity, serviceFn, payload) {
if(response) {
yield put(entity.success(response.data, payload));
} else if (error) {
yield put(entity.failure(error.message));
yield put(entity.failure(error.message || error));
}
}