Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ecommerce-maven
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
ecommerce-maven
Commits
11683e89
Commit
11683e89
authored
May 12, 2021
by
Christopher Cottier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order confirmation page uses order component to display order details
parent
fdecf06b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
2 deletions
+71
-2
checkout_actions.js
ecom-web/src/actions/checkout_actions.js
+1
-1
order-confirmation.css
.../src/components/order-confirmation/order-confirmation.css
+10
-0
order-confirmation.jsx
.../src/components/order-confirmation/order-confirmation.jsx
+33
-0
root.js
ecom-web/src/components/root.js
+2
-0
order_reducer.js
ecom-web/src/reducers/order_reducer.js
+25
-1
No files found.
ecom-web/src/actions/checkout_actions.js
View file @
11683e89
...
...
@@ -4,7 +4,7 @@ import { sendOrderPost } from './../util/order-api';
export
const
SEND_USER_ORDER
=
"SEND_USER_ORDER"
const
sendUserOrder
=
(
orderConfirmationResponse
)
=>
({
export
const
sendUserOrder
=
(
orderConfirmationResponse
)
=>
({
type
:
SEND_USER_ORDER
,
payload
:
orderConfirmationResponse
})
...
...
ecom-web/src/components/order-confirmation/order-confirmation.css
0 → 100644
View file @
11683e89
main
{
margin
:
0
auto
;
max-width
:
1080px
;
}
#order-confirmation-header
{
font-size
:
40px
;
text-align
:
center
;
padding
:
10px
;
}
\ No newline at end of file
ecom-web/src/components/order-confirmation/order-confirmation.jsx
0 → 100644
View file @
11683e89
import
React
,
{
useEffect
}
from
'react'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
Redirect
}
from
'react-router'
;
import
{
sendUserOrder
}
from
'../../actions/checkout_actions'
import
Order
from
'../order-history/Order'
;
import
'./order-confirmation.css'
const
OrderConfirmation
=
()
=>
{
const
dispatch
=
useDispatch
();
const
{
orderResponse
}
=
useSelector
(
state
=>
state
.
orderStatus
);
useEffect
(()
=>
{
return
()
=>
dispatch
(
sendUserOrder
({}));
},[])
const
orderPlaced
=
new
Date
(
orderResponse
.
orderCreatedAt
);
if
(
!
orderResponse
.
id
)
return
(<
Redirect
to=
"/product-market"
/>)
//once we have flow from place order page, this can be uncommented
return
(
<
main
>
<
h1
id=
"order-confirmation-header"
>
Thanks for your order!
</
h1
>
<
Order
order=
{
orderResponse
}
/>
</
main
>
);
}
export
default
OrderConfirmation
;
\ No newline at end of file
ecom-web/src/components/root.js
View file @
11683e89
...
...
@@ -7,6 +7,7 @@ import ShoppingCartContainer from './shopping-cart/shopping-cart-container';
import
CheckoutContianer
from
'./checkout/checkout-container'
;
import
Header
from
'./Header/header-container'
import
OrderHistory
from
'./order-history/order-history'
;
import
OrderConfirmation
from
'./order-confirmation/order-confirmation'
;
const
Root
=
({
store
})
=>
(
<
Provider
store
=
{
store
}
>
...
...
@@ -24,6 +25,7 @@ const Root = ({ store }) => (
<
Route
path
=
"/cart"
component
=
{
ShoppingCartContainer
}
/
>
<
Route
path
=
"/checkout"
component
=
{
CheckoutContianer
}
/
>
<
Route
path
=
"/orders"
component
=
{
OrderHistory
}
/
>
<
Route
path
=
"/order-confirmation"
component
=
{
OrderConfirmation
}
/
>
<
/Switch
>
<
/BrowserRouter
>
<
/Provider
>
...
...
ecom-web/src/reducers/order_reducer.js
View file @
11683e89
...
...
@@ -3,7 +3,31 @@ import { LOGOUT_USER } from '../actions/session_actions';
import
{
SEND_USER_ORDER
}
from
'./../actions/checkout_actions'
const
initialState
=
{
orderResponse
:
{},
//this will be empty object once we have checkout flow, rn just for conf page building / logic
orderResponse
:
{
"id"
:
"609c0005dd97fc4c9e0f8e63"
,
"customerId"
:
"104109244866071991182"
,
"customerEmailAddress"
:
"ccottier@nisum.com"
,
"orderTrackingCode"
:
"N/A"
,
"orderStatus"
:
"RECEIVED"
,
"orderCreatedAt"
:
1.620836357923E12
,
"orderUpdatedAt"
:
1.620836357923E12
,
"orderItems"
:
[
{
"itemName"
:
"Green T-Shirt"
,
"itemId"
:
"AFP-1"
,
"itemQuantity"
:
500
,
"itemPrice"
:
9.9
,
"itemSku"
:
"AFP-1"
}
],
"customerAddress"
:
{
"street"
:
"Grand"
,
"city"
:
"chicago"
,
"state"
:
"IL"
,
"zip"
:
"90210"
}
},
orderHistory
:
[]
}
...
...
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