Show "login failed" message

This commit is contained in:
Alex Gleason 2020-04-11 13:00:36 -05:00
parent 092fb5828b
commit 1b8544b758
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { createAuthApp, logIn } from 'gabsocial/actions/auth';
import { fetchMe } from 'gabsocial/actions/me';
import { Link } from 'react-router-dom';
import { showAlert } from 'gabsocial/actions/alerts';
export default @connect()
class LoginForm extends ImmutablePureComponent {
@ -27,8 +28,8 @@ class LoginForm extends ImmutablePureComponent {
const { username, password } = this.getFormData(event.target);
dispatch(logIn(username, password)).then(() => {
return dispatch(fetchMe());
}).catch(() => {
// TODO: Handle bad request
}).catch((error) => {
dispatch(showAlert('Login failed', 'Invalid username or password.'));
this.setState({isLoading: false});
});
this.setState({isLoading: true});

View file

@ -3,6 +3,7 @@ import { connect } from 'react-redux'
import ImmutablePureComponent from 'react-immutable-pure-component';
import { Link } from 'react-router-dom';
import LoginForm from 'gabsocial/features/auth_login';
import NotificationsContainer from 'gabsocial/features/ui/containers/notifications_container';
const mapStateToProps = (state, props) => ({
instance: state.get('instance'),
@ -118,6 +119,7 @@ class LandingPage extends ImmutablePureComponent {
</ul>
</div>
</div>
<NotificationsContainer />
</div>
)
}