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
ce1583f3
Commit
ce1583f3
authored
Apr 22, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update baeu
parent
bb2a774a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
globalActionType.js
redux/globalActionType.js
+0
-3
globalReducer.js
redux/globalReducer.js
+22
-15
No files found.
redux/globalActionType.js
View file @
ce1583f3
...
...
@@ -23,10 +23,7 @@ const ActionType = {
SET_CHANGE_OUTLET
:
'SET_CHANGE_OUTLET'
,
SET_CHANGE_SHOP
:
'SET_CHANGE_SHOP'
,
ADD_TO_CHART
:
'ADD_TO_CHART'
,
<<<<<<<
HEAD
=======
REMOVE_FROM_CHART
:
'REMOVE_FROM_CHART'
,
>>>>>>>
1
f2878b320428b9f86712643addd48e2a9859793
}
...
...
redux/globalReducer.js
View file @
ce1583f3
...
...
@@ -207,22 +207,28 @@ const rootReducer = (state = globalState, action) => {
}
}
case
ActionType
.
ADD_TO_CHART
:{
<<<<<<<
HEAD
let
addedItem
=
action
.
data
.
order_item
let
is_exist
=
cart_shop
.
find
(
item
=>
addedItem
.
id
==
item
.
id
)
=======
let
addedItem
=
action
.
data
.
item
let
is_exist
=
order_item
.
find
(
item
=>
addedItem
.
id
==
item
.
id
)
>>>>>>>
1
f2878b320428b9f86712643addd48e2a9859793
let
is_exist
=
state
.
order_item
.
find
(
item
=>
addedItem
.
id
==
item
.
id
)
let
order_item
=
state
.
order_item
;
if
(
is_exist
)
{
// update
addedItem
.
quantity
+=
1
console
.
log
(
'Update : '
+
JSON
.
stringify
(
addedItem
))
let
quantity
=
state
.
order_quantity
+
1
let
total
=
parseInt
(
state
.
order_total
)
+
parseInt
(
addedItem
.
price
)
return
{
...
state
,
order_quantity
:
quantity
,
order_total
:
total
}
}
else
{
// add
addedItem
.
quantity
=
1
}
let
quantity
=
order_quantity
+
1
let
total
=
order_total
+
addedItem
.
price
console
.
log
(
'Baru : '
+
JSON
.
stringify
(
addedItem
))
let
quantity
=
state
.
order_quantity
+
1
let
total
=
parseInt
(
state
.
order_total
)
+
parseInt
(
addedItem
.
price
)
return
{
...
state
,
...
...
@@ -231,6 +237,7 @@ const rootReducer = (state = globalState, action) => {
order_total
:
total
}
}
}
default
:
...
...
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