Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
clone_excelso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Prasetya Saputra
clone_excelso
Commits
eed83074
Commit
eed83074
authored
Jun 06, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reducer
parent
7f8dcb5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
globalReducer.js
redux/globalReducer.js
+20
-1
No files found.
redux/globalReducer.js
View file @
eed83074
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment