You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
891 B
TypeScript

import React from 'react';
import { connect } from 'react-redux';
import { loginAsync } from 'actions/auth-actions';
import LoginPageComponent from 'components/login-page/login-page';
import { CombinedState } from 'reducers/interfaces';
interface StateToProps {
fetching: boolean;
}
interface DispatchToProps {
onLogin(username: string, password: string): void;
}
function mapStateToProps(state: CombinedState): StateToProps {
return {
fetching: state.auth.fetching,
};
}
function mapDispatchToProps(dispatch: any): DispatchToProps {
return {
onLogin: (...args): void => dispatch(loginAsync(...args)),
};
}
function LoginPageContainer(props: DispatchToProps & StateToProps): JSX.Element {
return (
<LoginPageComponent {...props} />
);
}
export default connect(
mapStateToProps,
mapDispatchToProps,
)(LoginPageContainer);