Commit da9a9de0 authored by Christopher Cottier's avatar Christopher Cottier

error handling for navigating to order history with no user

parent 77ba1f47
......@@ -25,6 +25,7 @@ public class OrderService {
Address address = orderRequest.getAddress();
CartPostDTO cart = orderRequest.getCart();
//for each item grab product details from products API
List<Mono<Product>> productsToOrder = cart.getCartItems().stream()
.map(cartItem -> cartItem.getProductRef().getSku())
......
......@@ -23,3 +23,9 @@ main {
.order-field {
font-weight: 600;
}
#order-history-header {
font-size: 40px;
text-align: center;
padding: 10px;
}
......@@ -13,7 +13,7 @@ const OrderHistory = () => {
const {currentUser} = useSelector(state => state.user);
useEffect( async () => {
if (callMade) return;
if (callMade || currentUser === null) return;
const userHistory = await getOrderHistory(currentUser.userId); //insert user id from user details stored in redux
setOrderHistory(userHistory);
setCallMade(true);
......@@ -21,8 +21,10 @@ const OrderHistory = () => {
return (
<main>
<h1>Order History</h1>
<h1 id="order-history-header">Order History</h1>
{currentUser === null ? (
<div>Please login to place orders!</div>
) : null}
<div id="orders">
{orderHistory.map(order => {
return <Order order={order}/>;
......
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