Skip to content

Commit 1038508

Browse files
variables in graphql queries
1 parent 04bfbe9 commit 1038508

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frontend/src/pages/Bookings.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ export default class Bookings extends Component {
5656
deleteBookingHandler = (bookingId) => {
5757
const requestBody = {
5858
query: `
59-
mutation {
60-
cancelBooking(bookingId: "${bookingId}") {
59+
mutation CancelBooking($id: ID!) {
60+
cancelBooking(bookingId: $id) {
6161
_id
6262
title
6363
}
6464
}
6565
`,
66+
variables: {
67+
id: bookingId,
68+
},
6669
};
6770

6871
fetch('http://localhost:5000/api', {

0 commit comments

Comments
 (0)