action-create-chat.js 858 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import actionPromise from "./action-promise"
  2. import { gql } from '../../graphQl/getGQL'
  3. export const actionCreateChat = (title, members, chatId, membersId) =>
  4. actionPromise(
  5. 'updateChat',
  6. gql(
  7. `mutation updateChat($chat:ChatInput) {
  8. ChatUpsert(chat:$chat) {
  9. _id
  10. title
  11. avatar {
  12. _id
  13. url
  14. }
  15. owner {
  16. _id
  17. login
  18. avatar {
  19. _id
  20. url
  21. }
  22. }
  23. members {
  24. _id
  25. login
  26. nick
  27. avatar {
  28. _id
  29. url
  30. }
  31. }
  32. lastModified
  33. }
  34. }`,
  35. // { chat: { _id: chatId, title, members }, members: {_id: userId} }
  36. { chat: { title: title, members: {_id: members}} }
  37. )
  38. )