Guest User

Untitled

a guest
Apr 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. const resolvers = {
  2. Query: {
  3. // ... like before
  4. },
  5. Mutation: {
  6. // ... like before
  7. },
  8. Subscription: {
  9. publications: {
  10. // ... like before
  11. },
  12. postDeleted: {
  13. subscribe: (parent, args, ctx, info) => {
  14. const selectionSet = `{ previousValues { id title } }`
  15. return ctx.db.subscription.post(
  16. {
  17. where: {
  18. mutation_in: ['DELETED'],
  19. },
  20. },
  21. selectionSet,
  22. )
  23. },
  24. resolve: (payload, args, context, info) => {
  25. return payload ? payload.post.previousValues : payload
  26. },
  27. },
  28. },
  29. }
Add Comment
Please, Sign In to add comment