diff options
Diffstat (limited to 'frontend/src/@redux/utils')
-rw-r--r-- | frontend/src/@redux/utils/index.ts | 2 | ||||
-rw-r--r-- | frontend/src/@redux/utils/mapper.ts | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/frontend/src/@redux/utils/index.ts b/frontend/src/@redux/utils/index.ts index e0e063f0d..c269932da 100644 --- a/frontend/src/@redux/utils/index.ts +++ b/frontend/src/@redux/utils/index.ts @@ -4,7 +4,7 @@ export function defaultAOS(): AsyncOrderState<any> { data: { items: [], order: [], - dirty: false, + dirty: true, }, }; } diff --git a/frontend/src/@redux/utils/mapper.ts b/frontend/src/@redux/utils/mapper.ts index 772caa39a..1236b2af9 100644 --- a/frontend/src/@redux/utils/mapper.ts +++ b/frontend/src/@redux/utils/mapper.ts @@ -36,7 +36,7 @@ export function updateOrderIdState<T extends LooseObject>( return { data: { ...state.data, - dirty: true, + dirty: false, }, updating: true, }; @@ -44,7 +44,7 @@ export function updateOrderIdState<T extends LooseObject>( return { data: { ...state.data, - dirty: true, + dirty: false, }, updating: false, error: action.payload.item as Error, @@ -107,7 +107,7 @@ export function updateOrderIdState<T extends LooseObject>( return { updating: false, data: { - dirty: true, + dirty: false, items: newItems, order: newOrder, }, @@ -131,13 +131,25 @@ export function deleteOrderListItemBy<T extends LooseObject>( return { ...state, data: { - dirty: true, + dirty: false, items: newItems, order: newOrder, }, }; } +export function markOrderListDirty( + state: AsyncOrderState<any> +): AsyncOrderState<any> { + return { + ...state, + data: { + ...state.data, + dirty: true, + }, + }; +} + export function deleteAsyncListItemBy<T extends LooseObject>( action: Action<number[]>, state: AsyncState<T[]>, |