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
bfb60f7e
Commit
bfb60f7e
authored
May 10, 2021
by
Christopher Cottier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed merge conflicts
parent
3bea8ff0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
28 deletions
+92
-28
order_actions.js
ecom-web/src/actions/order_actions.js
+38
-0
Order.jsx
ecom-web/src/components/order-history/Order.jsx
+13
-0
order-history-container.jsx
.../src/components/order-history/order-history-container.jsx
+0
-12
order-history.css
ecom-web/src/components/order-history/order-history.css
+4
-0
order-history.jsx
ecom-web/src/components/order-history/order-history.jsx
+26
-13
root.js
ecom-web/src/components/root.js
+3
-3
config.js
ecom-web/src/config.js
+8
-0
No files found.
ecom-web/src/actions/order_actions.js
0 → 100644
View file @
bfb60f7e
import
Config
from
"../config"
;
export
const
getOrderHistory
=
async
(
userId
)
=>
{
//This is what we will return once our oder history API is operational
// const res = await fetch(`${Config.orderHistoryApiUrlMethod(userId)}`);
// const orders = await res.json();
// return orders;
return
(
[
{
id
:
"609968a89cc32e1ef8208e8b"
,
orderTrackingCode
:
"N/A"
,
orderStatus
:
"RECEIVED"
,
orderCreatedAt
:
1620666536727
,
orderUpdatedAt
:
1620666536727
,
customerId
:
"e-com-test-id2"
,
customerEmailAddress
:
"test@test.test"
,
orderItems
:
[
{
itemId
:
"AFP-989"
,
itemName
:
"this item"
,
itemSku
:
"AFP-989"
,
itemQuantity
:
2
,
itemPrice
:
14.0
}
],
customerAddress
:
{
street
:
"Grand"
,
city
:
"chicago"
,
state
:
"IL"
,
zip
:
"90210"
}
}
]
)
}
\ No newline at end of file
ecom-web/src/components/order-history/Order.jsx
0 → 100644
View file @
bfb60f7e
import
React
from
'react'
;
const
Order
=
(
props
)
=>
{
const
{
order
}
=
props
;
console
.
log
(
order
);
return
(
null
)
}
export
default
Order
;
\ No newline at end of file
ecom-web/src/components/order-history/order-history-container.jsx
deleted
100644 → 0
View file @
3bea8ff0
import
{
connect
}
from
'react-redux'
;
import
OrderHistory
from
'./order-history'
;
const
mSTP
=
state
=>
({
});
const
mDTP
=
dispatch
=>
({
});
export
default
connect
(
mSTP
,
mDTP
)(
OrderHistory
);
\ No newline at end of file
ecom-web/src/components/order-history/order-history.css
0 → 100644
View file @
bfb60f7e
main
{
margin
:
0
auto
;
max-width
:
1080px
;
}
\ No newline at end of file
ecom-web/src/components/order-history/order-history.jsx
View file @
bfb60f7e
import
React
,
{
Component
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
getOrderHistory
}
from
'../../actions/order_actions'
;
import
Order
from
'./Order'
;
export
default
class
OrderHistory
extends
Component
{
import
'./order-history.css'
constructor
(
props
)
{
super
(
props
)
const
OrderHistory
=
()
=>
{
this
.
state
=
{}
}
const
[
orderHistory
,
setOrderHistory
]
=
useState
([]);
useEffect
(
async
()
=>
{
const
userHistory
=
await
getOrderHistory
(
'e-com-test-id2'
);
setOrderHistory
(
userHistory
);
},
[
orderHistory
]);
render
()
{
return
(
return
(
<
div
>
<
main
>
This is the OrderHistory component
<
h1
>
Order History
</
h1
>
<
div
id=
"orders"
>
{
orderHistory
.
map
(
order
=>
{
return
<
Order
order=
{
order
}
/>;
})
}
</
div
>
</
div
>
</
main
>
)
)
}
}
}
export
default
OrderHistory
;
\ No newline at end of file
ecom-web/src/components/root.js
View file @
bfb60f7e
...
@@ -5,8 +5,8 @@ import SessionContainer from './session/session-container';
...
@@ -5,8 +5,8 @@ import SessionContainer from './session/session-container';
import
ProductMarketContainer
from
'./product-market/product-market-container'
;
import
ProductMarketContainer
from
'./product-market/product-market-container'
;
import
ShoppingCartContainer
from
'./shopping-cart/shopping-cart-container'
;
import
ShoppingCartContainer
from
'./shopping-cart/shopping-cart-container'
;
import
CheckoutContianer
from
'./checkout/checkout-container'
;
import
CheckoutContianer
from
'./checkout/checkout-container'
;
import
OrderHistoryContainer
from
'./order-history/order-history'
;
import
Header
from
'./Header/header-container'
import
Header
from
'./Header/header-container'
import
OrderHistory
from
'./order-history/order-history'
;
const
Root
=
({
store
})
=>
(
const
Root
=
({
store
})
=>
(
<
Provider
store
=
{
store
}
>
<
Provider
store
=
{
store
}
>
...
@@ -19,7 +19,7 @@ const Root = ({ store }) => (
...
@@ -19,7 +19,7 @@ const Root = ({ store }) => (
return
(
return
(
// this.state.isUserAuthenticated ? // This can be changed for however our frontend user auth will operate
// this.state.isUserAuthenticated ? // This can be changed for however our frontend user auth will operate
// <Redirect to="/product-market" /> :
// <Redirect to="/product-market" /> :
<
Redirect
to
=
"/
product-market
"
/>
<
Redirect
to
=
"/
orders
"
/>
)
)
}}
}}
/
>
/
>
...
@@ -27,7 +27,7 @@ const Root = ({ store }) => (
...
@@ -27,7 +27,7 @@ const Root = ({ store }) => (
<
Route
path
=
"/product-market"
component
=
{
ProductMarketContainer
}
/
>
<
Route
path
=
"/product-market"
component
=
{
ProductMarketContainer
}
/
>
<
Route
path
=
"/cart"
component
=
{
ShoppingCartContainer
}
/
>
<
Route
path
=
"/cart"
component
=
{
ShoppingCartContainer
}
/
>
<
Route
path
=
"/checkout"
component
=
{
CheckoutContianer
}
/
>
<
Route
path
=
"/checkout"
component
=
{
CheckoutContianer
}
/
>
<
Route
path
=
"/orders"
component
=
{
OrderHistory
Container
}
/
>
<
Route
path
=
"/orders"
component
=
{
OrderHistory
}
/
>
<
/Switch
>
<
/Switch
>
<
/BrowserRouter
>
<
/BrowserRouter
>
<
/Provider
>
<
/Provider
>
...
...
ecom-web/src/config.js
0 → 100644
View file @
bfb60f7e
class
Config
{
static
baseApiUrl
=
"http://localhost:8080/api"
;
//env file
static
orderHistoryApiUrlMethod
=
(
userId
)
=>
`
${
this
.
baseApiUrl
}
/users/
${
userId
}
/orders`
;
}
export
default
Config
;
\ No newline at end of file
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