Show "login failed" message
This commit is contained in:
parent
092fb5828b
commit
1b8544b758
2 changed files with 5 additions and 2 deletions
|
@ -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});
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue