Commit eed83074 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

reducer

parent 7f8dcb5a
......@@ -718,7 +718,8 @@ const rootReducer = (state = globalState, action) => {
case ActionType.SET_EDIT_NOTE: {
const update = action.data.item;
const menu = action.data.item
console.log("INI HASILNY"+ menu)
// Cara 1
updated_data = []
for (let i = 0; i < state.order_item.length; i++) {
......@@ -736,6 +737,24 @@ const rootReducer = (state = globalState, action) => {
}
}
updated_menu = []
for (let i = 0; i < state.menu_item.length; i++) {
const old_data = state.menu_item[i];
const data = old_data;
// dicari dulu object mana yg mau diupdate
if (old_data.id == menu.id) {
// kalo ketemu update data notenya
data.note = menu.note
updated_menu.push(data)
} else {
// kalo bukan biarin pakai yg lama
updated_menu.push(data)
}
console.log(JSON.stringify())
}
// // Cara 2
// updated_data = state.order_item
......
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