Export the Mutation Function
May 17, 2020
In this chapter we just set up our mutation by exporting it.
In the mutation.js
file add the following function:
export const makeABooking = async (args, context) => {
return null
}
Then head over the the index
of the resolvers and import it:
import { makeABooking } from "./mutation"
export const resolvers = {
Mutation: {
makeABooking: (root, args, context) => makeABooking(args, context),
},
}
Your resolvers index.js
should look like this:
import { getAllListings, getAListing } from "./query"
import { makeABooking } from "./mutation"
export const resolvers = {
Query: {
getAllListings: (root, args, context) => getAllListings(args, context),
getAListing: (root, args, context) => getAListing(args, context),
},
Mutation: {
makeABooking: (root, args, context) => makeABooking(args, context),
},
}
Next up we will setup a Stripe Account