1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

Add email and password change functionality for a current user, remove deep compare hooks

This commit is contained in:
Maksim Eltyshev 2019-10-18 08:06:34 +05:00
parent b53e5bf94c
commit 680d664279
67 changed files with 1232 additions and 267 deletions

View file

@ -1,59 +1,19 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { authenticate, clearAuthenticationError } from '../actions/entry';
import { authenticate, clearAuthenticateError } from '../actions/entry';
import Login from '../components/Login';
const mapStateToProps = ({ login: { data: defaultData, isSubmitting, error: externalError } }) => {
let error;
if (externalError) {
switch (externalError.message) {
case 'Email does not exist':
error = {
message: 'emailDoesNotExist',
};
break;
case 'Password is not valid':
error = {
message: 'invalidPassword',
};
break;
case 'Failed to fetch':
error = {
type: 'warning',
message: 'noInternetConnection',
};
break;
case 'Network request failed':
error = {
type: 'warning',
message: 'serverConnectionFailed',
};
break;
default:
error = {
type: 'warning',
message: 'unknownError',
};
}
}
return {
defaultData,
isSubmitting,
error,
};
};
const mapStateToProps = ({ authenticateForm: { data: defaultData, isSubmitting, error } }) => ({
defaultData,
isSubmitting,
error,
});
const mapDispatchToProps = (dispatch) => bindActionCreators(
{
onAuthenticate: authenticate,
onMessageDismiss: clearAuthenticationError,
onMessageDismiss: clearAuthenticateError,
},
dispatch,
);