mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
Fix PR review
Signed-off-by: HichamELBSI <elabbassih@gmail.com>
This commit is contained in:
parent
3750b507ab
commit
9d4b71ffbc
@ -20,22 +20,27 @@ const reducer = (state = initialState, action) =>
|
||||
produce(state, draftState => {
|
||||
const layoutPathEdit = ['modifiedData', 'layouts', 'edit'];
|
||||
const layoutPathRelations = ['modifiedData', 'layouts', 'editRelations'];
|
||||
|
||||
switch (action.type) {
|
||||
case 'ADD_RELATION': {
|
||||
const layoutFieldList = get(state, layoutPathRelations, []);
|
||||
set(draftState, layoutPathRelations, [...layoutFieldList, action.name]);
|
||||
const editRelationLayoutValue = get(state, layoutPathRelations, []);
|
||||
set(draftState, layoutPathRelations, [...editRelationLayoutValue, action.name]);
|
||||
break;
|
||||
}
|
||||
case 'MOVE_RELATION': {
|
||||
const layoutFieldList = get(state, layoutPathRelations, []);
|
||||
const editRelationLayoutValue = get(state, layoutPathRelations, []);
|
||||
const { fromIndex, toIndex } = action;
|
||||
set(draftState, layoutPathRelations, arrayMoveItem(layoutFieldList, fromIndex, toIndex));
|
||||
set(
|
||||
draftState,
|
||||
layoutPathRelations,
|
||||
arrayMoveItem(editRelationLayoutValue, fromIndex, toIndex)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'MOVE_ROW': {
|
||||
const layoutFieldRowList = get(state, layoutPathEdit, []);
|
||||
const editFieldLayoutValue = get(state, layoutPathEdit, []);
|
||||
const { fromIndex, toIndex } = action;
|
||||
set(draftState, layoutPathEdit, arrayMoveItem(layoutFieldRowList, fromIndex, toIndex));
|
||||
set(draftState, layoutPathEdit, arrayMoveItem(editFieldLayoutValue, fromIndex, toIndex));
|
||||
break;
|
||||
}
|
||||
case 'ON_ADD_FIELD': {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user