Commit bfb60f7e authored by Christopher Cottier's avatar Christopher Cottier

fixed merge conflicts

parent 3bea8ff0
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
import React from 'react';
const Order = (props) => {
const {order} = props;
console.log(order);
return (
null
)
}
export default Order;
\ No newline at end of file
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
main {
margin: 0 auto;
max-width: 1080px;
}
\ No newline at end of file
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([]);
render() { useEffect( async () => {
return ( const userHistory = await getOrderHistory('e-com-test-id2');
<div> setOrderHistory(userHistory);
This is the OrderHistory component }, [orderHistory]);
return (
<main>
<h1>Order History</h1>
<div id="orders">
{orderHistory.map(order => {
return <Order order={order}/>;
})}
</div> </div>
) </main>
} )
} }
\ No newline at end of file
export default OrderHistory;
\ No newline at end of file
...@@ -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={ OrderHistoryContainer } /> <Route path="/orders" component={ OrderHistory } />
</Switch> </Switch>
</BrowserRouter> </BrowserRouter>
</Provider> </Provider>
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment