April 2020
Intermediate to advanced
716 pages
18h 55m
English
We will update the code for the auctions list view to conditionally show the edit and delete options to the seller. In the Auctions component, which is where a list of auctions is iterated over to render each item in ListItem, we will add two more options in the ListItemSecondaryAction component, as shown in the following code.
mern-marketplace/client/auction/Auctions.js:
<ListItemSecondaryAction> <Link to={"/auction/" + auction._id}> <IconButton aria-label="View" color="primary"> <ViewIcon/> </IconButton> </Link> { auth.isAuthenticated().user && auth.isAuthenticated().user._id == auction.seller._id && (<> <Link to={"/auction/edit/" + auction._id}> <IconButton aria-label="Edit" color="primary"> <Edit/> </IconButton> ...Read now
Unlock full access