1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-21 22:29:42 +02:00
planka/client/src/reducers/ui/authenticate-form.js

40 lines
809 B
JavaScript
Raw Normal View History

import ActionTypes from '../../constants/ActionTypes';
2019-08-31 04:07:25 +05:00
const initialState = {
data: {
2020-04-03 00:35:25 +05:00
emailOrUsername: '',
2019-08-31 04:07:25 +05:00
password: '',
},
isSubmitting: false,
error: null,
};
export default (state = initialState, { type, payload }) => {
switch (type) {
case ActionTypes.AUTHENTICATE:
return {
...state,
data: {
...state.data,
...payload.data,
},
isSubmitting: true,
};
case ActionTypes.AUTHENTICATE__SUCCESS:
2019-08-31 04:07:25 +05:00
return initialState;
case ActionTypes.AUTHENTICATE__FAILURE:
2019-08-31 04:07:25 +05:00
return {
...state,
isSubmitting: false,
error: payload.error,
};
case ActionTypes.AUTHENTICATE_ERROR_CLEAR:
return {
...state,
error: null,
};
2019-08-31 04:07:25 +05:00
default:
return state;
}
};