mirror of
https://github.com/plankanban/planka.git
synced 2025-07-25 16:19:47 +02:00
Add email and password change functionality for a current user, remove deep compare hooks
This commit is contained in:
parent
e564729598
commit
2566ff376e
67 changed files with 1232 additions and 267 deletions
43
client/src/reducers/forms/authenticate.js
Normal file
43
client/src/reducers/forms/authenticate.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import ActionTypes from '../../constants/ActionTypes';
|
||||
|
||||
const initialState = {
|
||||
data: {
|
||||
email: '',
|
||||
password: '',
|
||||
},
|
||||
isSubmitting: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export default (state = initialState, { type, payload }) => {
|
||||
switch (type) {
|
||||
case ActionTypes.AUTHENTICATE:
|
||||
return {
|
||||
...state,
|
||||
data: {
|
||||
...state.data,
|
||||
...payload.data,
|
||||
},
|
||||
};
|
||||
case ActionTypes.AUTHENTICATE_ERROR_CLEAR:
|
||||
return {
|
||||
...state,
|
||||
error: null,
|
||||
};
|
||||
case ActionTypes.AUTHENTICATE_REQUESTED:
|
||||
return {
|
||||
...state,
|
||||
isSubmitting: true,
|
||||
};
|
||||
case ActionTypes.AUTHENTICATE_SUCCEEDED:
|
||||
return initialState;
|
||||
case ActionTypes.AUTHENTICATE_FAILED:
|
||||
return {
|
||||
...state,
|
||||
isSubmitting: false,
|
||||
error: payload.error,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue