The OrderHistory component was designed assuming that the orderHistory property on the Users DB model would be an array of integers representing product IDs; we have since changed it to an array of arrays, where each array is a cart that was checked out and ordered, containing objects with a product and its quantity.
Order history: [ [ {Product: {Object representing product}, Quantity: integer}, {another productObj} ], [another order event], [more order events] ]
The OrderHistory component should be updated so that it displays a list of the orderHistory sub-arrays (which could be just divs with styling we write if we have time, or maybe be components in their own right), each one containing a set of ProductCard components. It should get the necessary data from user.OrderHistory, and not make any new database calls or filter anything. When this is done, we can also remove the DB call for allproducts from the SingleUser component.
I think the best time to do this is after we finish creating the checkout functionality, which is what will actually push carts into the orderHistory field on the User model.
The OrderHistory component was designed assuming that the orderHistory property on the Users DB model would be an array of integers representing product IDs; we have since changed it to an array of arrays, where each array is a cart that was checked out and ordered, containing objects with a product and its quantity.
Order history: [ [ {Product: {Object representing product}, Quantity: integer}, {another productObj} ], [another order event], [more order events] ]
The OrderHistory component should be updated so that it displays a list of the orderHistory sub-arrays (which could be just divs with styling we write if we have time, or maybe be components in their own right), each one containing a set of ProductCard components. It should get the necessary data from user.OrderHistory, and not make any new database calls or filter anything. When this is done, we can also remove the DB call for allproducts from the SingleUser component.
I think the best time to do this is after we finish creating the checkout functionality, which is what will actually push carts into the orderHistory field on the User model.