Fix bugs, cards now link to order

This commit is contained in:
Reckless_Satoshi 2022-01-04 08:27:15 -08:00
parent 78886c8c9c
commit 4d9a5023e0
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 6 additions and 5 deletions

View File

@ -97,7 +97,8 @@ class OrderView(APIView):
return Response(data, status=status.HTTP_200_OK) return Response(data, status=status.HTTP_200_OK)
else: else:
# Non participants should not see the status or who is the taker # Non participants should not see the status or who is the taker
data.pop('status','status_message','taker','taker_nick') for key in ('status','status_message','taker','taker_nick'):
del data[key]
return Response(data, status=status.HTTP_200_OK) return Response(data, status=status.HTTP_200_OK)
return Response({'Order Not Found':'Invalid Order Id'},status=status.HTTP_404_NOT_FOUND) return Response({'Order Not Found':'Invalid Order Id'},status=status.HTTP_404_NOT_FOUND)

View File

@ -23,8 +23,8 @@ export default class BookPage extends Component {
} }
handleCardClick=(e)=>{ handleCardClick=(e)=>{
console.log(e.target) console.log(e)
this.props.history.push('/order/' + e.target); this.props.history.push('/order/' + e);
} }
// Make these two functions sequential. getOrderDetails needs setState to be finish beforehand. // Make these two functions sequential. getOrderDetails needs setState to be finish beforehand.
@ -107,7 +107,7 @@ export default class BookPage extends Component {
<Card elevation={6} sx={{ width: 945 }}> <Card elevation={6} sx={{ width: 945 }}>
{/* To fix! does not pass order.id to handleCardCLick. Instead passes the clicked </>*/} {/* To fix! does not pass order.id to handleCardCLick. Instead passes the clicked </>*/}
<CardActionArea value={order.id} onClick={this.handleCardClick}> <CardActionArea value={order.id} onClick={() => this.handleCardClick(order.id)}>
<CardContent> <CardContent>
<List dense="true"> <List dense="true">

View File

@ -103,7 +103,7 @@ export default class OrderPage extends Component {
{this.state.isParticipant ? "" : <Button variant='contained' color='primary' to='/home' component={Link}>Take Order</Button>} {this.state.isParticipant ? "" : <Button variant='contained' color='primary' to='/home' component={Link}>Take Order</Button>}
</Grid> </Grid>
<Grid item xs={12} align="center"> <Grid item xs={12} align="center">
{this.state.isParticipant ? "" : <Button variant='contained' color='secondary' onClick={this.handleClickBackButton}>Back</Button>} <Button variant='contained' color='secondary' onClick={this.handleClickBackButton}>Back</Button>
</Grid> </Grid>
</Paper> </Paper>
</Grid> </Grid>