Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
order-management-react
Project
Project
Details
Activity
Releases
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
Ascend
order-management-react
Commits
cf0319c4
Commit
cf0319c4
authored
May 05, 2021
by
Kevin Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-26]
🚧
Product type working
parent
fc2ae2dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
OrderShowDetails.tsx
src/components/OrderShowDetails.tsx
+11
-2
OrderShowPage.tsx
src/pages/OrderShowPage.tsx
+4
-2
No files found.
src/components/OrderShowDetails.tsx
View file @
cf0319c4
import
React
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
OrderService
}
from
'services'
;
import
{
Product
}
from
'Order'
;
const
OrderShowDetails
=
(
props
:
any
)
=>
{
const
orderProductDetails
=
props
.
products
.
map
((
prod
:
any
,
idx
:
any
)
=>
{
const
[
products
,
setProducts
]
=
useState
<
Product
[]
>
()
useEffect
(()
=>
{
setProducts
(
props
.
products
)
},
[
props
.
products
])
if
(
!
products
)
{
return
(<></>)
}
const
orderProductDetails
=
products
.
map
((
prod
:
Product
,
idx
:
any
)
=>
{
return
(
<
tr
key=
{
idx
}
>
<
td
><
img
src=
{
prod
.
productImageUrl
}
alt=
"img placeholder"
/></
td
>
...
...
src/pages/OrderShowPage.tsx
View file @
cf0319c4
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
OrderService
}
from
'services'
;
import
{
OrderShowDetails
}
from
'components'
;
import
{
Order
}
from
'Order'
;
import
{
Order
,
Product
}
from
'Order'
;
const
OrderShowPage
=
(
props
:
any
)
=>
{
const
location
=
parseInt
(
props
.
match
.
params
.
id
);
const
[
order
,
setOrder
]
=
useState
<
Order
>
();
const
[
products
,
setProducts
]
=
useState
<
Product
[]
>
()
useEffect
(()
=>
{
OrderService
.
orderById
(
location
).
then
((
res
:
any
)
=>
{
setOrder
(
res
);
setProducts
(
res
.
orderItems
);
})
})
...
...
@@ -24,7 +26,7 @@ const OrderShowPage = (props: any) => {
<
h3
>
Order Status: Fulfilled
</
h3
>
</
span
>
<
OrderShowDetails
products=
{
order
.
orderItem
s
}
/>
<
OrderShowDetails
products=
{
product
s
}
/>
</>
)
}
...
...
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