1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00
planka/client/src/reducers/ui/authenticate-form.js
2022-02-09 00:56:01 +05:00

40 lines
856 B
JavaScript

import ActionTypes from '../../constants/ActionTypes';
const initialState = {
data: {
emailOrUsername: '',
password: '',
},
isSubmitting: false,
error: null,
};
// eslint-disable-next-line default-param-last
export default (state = initialState, { type, payload }) => {
switch (type) {
case ActionTypes.AUTHENTICATE:
return {
...state,
data: {
...state.data,
...payload.data,
},
isSubmitting: true,
};
case ActionTypes.AUTHENTICATE__SUCCESS:
return initialState;
case ActionTypes.AUTHENTICATE__FAILURE:
return {
...state,
isSubmitting: false,
error: payload.error,
};
case ActionTypes.AUTHENTICATE_ERROR_CLEAR:
return {
...state,
error: null,
};
default:
return state;
}
};