mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 21:29:43 +02:00
Initial commit
This commit is contained in:
commit
36fe34e8e1
583 changed files with 91539 additions and 0 deletions
43
client/src/reducers/user.js
Executable file
43
client/src/reducers/user.js
Executable file
|
@ -0,0 +1,43 @@
|
|||
import ActionTypes from '../constants/ActionTypes';
|
||||
|
||||
const initialState = {
|
||||
data: {
|
||||
email: '',
|
||||
name: '',
|
||||
},
|
||||
isSubmitting: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export default (state = initialState, { type, payload }) => {
|
||||
switch (type) {
|
||||
case ActionTypes.USER_CREATE:
|
||||
return {
|
||||
...state,
|
||||
data: {
|
||||
...state.data,
|
||||
...payload.data,
|
||||
},
|
||||
};
|
||||
case ActionTypes.USER_CREATION_ERROR_CLEAR:
|
||||
return {
|
||||
...state,
|
||||
error: null,
|
||||
};
|
||||
case ActionTypes.USER_CREATE_REQUESTED:
|
||||
return {
|
||||
...state,
|
||||
isSubmitting: true,
|
||||
};
|
||||
case ActionTypes.USER_CREATE_SUCCEEDED:
|
||||
return initialState;
|
||||
case ActionTypes.USER_CREATE_FAILED:
|
||||
return {
|
||||
...state,
|
||||
isSubmitting: false,
|
||||
error: payload.error,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue