ОШИБКА в запросе на чтение с использованием n AWS AppSyn c Chat Starter App, написанного на Angular «Не удается найти поле allMessageConnection» - PullRequest
1 голос
/ 10 июля 2020

const сообщение: Сообщение = {идентификатор беседы: идентификатор беседы, контент: this.message, createdAt: идентификатор, отправитель: this.senderId, isSent: false, идентификатор: идентификатор,}; this.appsyn c .h c (). then ((client) => {client .mutate ({mutation: createMessage, variables: message,

      optimisticResponse: () => ({
        createMessage: {
          ...message,
          __typename: "Message",
        },
      }),

      update: (proxy, { data: { createMessage: _message } }) => {
        const options = {
          query: getConversationMessages,
          variables: {
            conversationId: conversationId,
            first: constants.messageFirst,
          },
        };
        // error on below line
        const data = proxy.readQuery(options);
        const _tmp = unshiftMessage(data, _message);
        proxy.writeQuery({ ...options, data: _tmp });
      },
    })
    .then(({ data }) => {
      console.log("mutation complete", data);
      console.log("mutation complete", data);
    })
    .catch((err) => console.log("Error creating message", err));
});
Analytics.record("Chat MSG Sent");

}

ERROR errorHandling. js: 7 Ошибка: не удается найти поле allMessageConnection ({"talkId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "first": 100}) на объекте {"me": {"type": "id", "created": false, "id": "User: XXXXXXXXXXXXXXXXXXXX", "typename": "User"}}.

ОШИБКА НА КОНСОЛИ

...