Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const resolvers = {
- Query: {
- // ... like before
- },
- Mutation: {
- // ... like before
- },
- Subscription: {
- publications: {
- // ... like before
- },
- postDeleted: {
- subscribe: (parent, args, ctx, info) => {
- const selectionSet = `{ previousValues { id title } }`
- return ctx.db.subscription.post(
- {
- where: {
- mutation_in: ['DELETED'],
- },
- },
- selectionSet,
- )
- },
- resolve: (payload, args, context, info) => {
- return payload ? payload.post.previousValues : payload
- },
- },
- },
- }
Add Comment
Please, Sign In to add comment