May 2018
Intermediate to advanced
470 pages
13h 54m
English
The GameDetail component will show the edit and delete options only if the currently signed-in user is also the maker of the game being rendered.
mern-vrgame/client/game/GameDetail.js:
{auth.isAuthenticated().user && auth.isAuthenticated().user._id == this.props.game.maker._id && (<div> <Link to={"/game/edit/" + this.props.game._id}> <Button variant="raised" color="primary" className={classes.editbutton}> Edit </Button> </Link> <DeleteGame game={this.props.game} removeGame={this.props.updateGames}/> </div>)}
If the user ID of the signed-in user matches the maker ID in the game, the edit button linking to the edit form view and the DeleteGame component are shown in the view.
Read now
Unlock full access