feat: duplicate entry (#2956)

This commit is contained in:
Bartholomew
2019-12-11 02:33:02 +01:00
committed by Shawn Erquhart
parent 9ee5d4f66f
commit d180bffb44
11 changed files with 155 additions and 53 deletions

View File

@ -8,6 +8,7 @@ import {
DRAFT_CLEAR_ERRORS,
DRAFT_LOCAL_BACKUP_RETRIEVED,
DRAFT_CREATE_FROM_LOCAL_BACKUP,
DRAFT_CREATE_DUPLICATE_FROM_ENTRY,
ENTRY_PERSIST_REQUEST,
ENTRY_PERSIST_SUCCESS,
ENTRY_PERSIST_FAILURE,
@ -69,6 +70,16 @@ const entryDraftReducer = (state = Map(), action) => {
state.set('fieldsErrors', Map());
state.set('hasChanged', true);
});
case DRAFT_CREATE_DUPLICATE_FROM_ENTRY:
// Duplicate Entry
return state.withMutations(state => {
state.set('entry', fromJS(action.payload));
state.setIn(['entry', 'newRecord'], true);
state.set('mediaFiles', List());
state.set('fieldsMetaData', Map());
state.set('fieldsErrors', Map());
state.set('hasChanged', true);
});
case DRAFT_DISCARD:
return initialState;
case DRAFT_LOCAL_BACKUP_RETRIEVED: {