Commit 8d16db48 authored by Afid's avatar Afid

cara 1 dan 2

parent cb49347b
......@@ -708,6 +708,7 @@ const rootReducer = (state = globalState, action) => {
case ActionType.SET_EDIT_NOTE: {
const update = action.data.item;
// Cara 1
updated_data = []
for (let i = 0; i < state.order_item.length; i++) {
const old_data = state.order_item[i];
......@@ -724,6 +725,16 @@ const rootReducer = (state = globalState, action) => {
}
}
// Cara 2
updated_data = state.order_item
// dicari dulu index keberapa yg mau diupdate notenya
update_index = state.order_item.findIndex((obj => obj.id == update.id));
// update note
updated_data[update_index].note = update.note
return {
...state,
order_item: updated_data,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment