Commit b9273ddd authored by Christopher Cottier's avatar Christopher Cottier

user cannot access cart if not logged in

parent 6994d175
This diff is collapsed.
......@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import CartItem from './CartItem.js'
import './shopping-cart.css'
import { useSelector, useDispatch } from 'react-redux'
import { Link } from 'react-router-dom'
import { Link, Redirect } from 'react-router-dom'
import { updateUserCart } from './../../actions/cart_actions'
......@@ -74,7 +74,7 @@ export default function ShoppingCart() {
// Sync Cart with backend and redux global state
////////////////////////////////////////////////////////////////
useEffect(() => {
if (!userSession) return;
const cartUpdateObj = {
userId: userSession.email,
cartItems: cartRefs
......@@ -85,6 +85,7 @@ export default function ShoppingCart() {
}, [cartItems])
if (!userSession) return <Redirect to="/product-market" />
return (
<div id="shoppingCartContainer">
......
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