From 4d9a5023e05772e1667ec8509eb60e3ccd117973 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Tue, 4 Jan 2022 08:27:15 -0800 Subject: [PATCH] Fix bugs, cards now link to order --- api/views.py | 3 ++- frontend/src/components/BookPage.js | 6 +++--- frontend/src/components/OrderPage.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/views.py b/api/views.py index e7accd36..5eaf1a95 100644 --- a/api/views.py +++ b/api/views.py @@ -97,7 +97,8 @@ class OrderView(APIView): return Response(data, status=status.HTTP_200_OK) else: # 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({'Order Not Found':'Invalid Order Id'},status=status.HTTP_404_NOT_FOUND) diff --git a/frontend/src/components/BookPage.js b/frontend/src/components/BookPage.js index 13f6ef3b..055b114a 100644 --- a/frontend/src/components/BookPage.js +++ b/frontend/src/components/BookPage.js @@ -23,8 +23,8 @@ export default class BookPage extends Component { } handleCardClick=(e)=>{ - console.log(e.target) - this.props.history.push('/order/' + e.target); + console.log(e) + this.props.history.push('/order/' + e); } // Make these two functions sequential. getOrderDetails needs setState to be finish beforehand. @@ -107,7 +107,7 @@ export default class BookPage extends Component { {/* To fix! does not pass order.id to handleCardCLick. Instead passes the clicked */} - + this.handleCardClick(order.id)}> diff --git a/frontend/src/components/OrderPage.js b/frontend/src/components/OrderPage.js index 50c526fa..2e6db655 100644 --- a/frontend/src/components/OrderPage.js +++ b/frontend/src/components/OrderPage.js @@ -103,7 +103,7 @@ export default class OrderPage extends Component { {this.state.isParticipant ? "" : } - {this.state.isParticipant ? "" : } +