mirror of
https://github.com/plankanban/planka.git
synced 2025-07-22 22:59:44 +02:00
44 lines
884 B
JavaScript
44 lines
884 B
JavaScript
|
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.AUTHENTICATION_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;
|
||
|
}
|
||
|
};
|