sendAttachment()

in src/components/Chat/ChatSession.js [246:275]


  sendAttachment(transcriptItem) {
    const {participantId, displayName} = this.thisParticipant;
    return this.client
        .sendAttachment(transcriptItem.content)
        .then(response => {
          console.log("RESPONSE", response);
          console.log("sendAttachment response:", response);
          this.transcript.splice(this.transcript.indexOf(transcriptItem), 1);
          return response;
        }).catch(error => {
          transcriptItem.transportDetails.error = {
            type: error.type,
            message: error.message,
          };
          if(error.type !== AttachmentErrorType.ValidationException){
            transcriptItem.transportDetails.error.message = "Attachment failed to send";
            transcriptItem.transportDetails.error.retry = () => {
              const newTranscriptItem = modelUtils.createOutgoingTranscriptItem(
                  ATTACHMENT_MESSAGE,
                  transcriptItem.content,
                  { displayName, participantId }
              );
              newTranscriptItem.id = transcriptItem.id;
              this._replaceItemInTranscript(transcriptItem, newTranscriptItem);
              this.sendAttachment(newTranscriptItem);
            }
          }
          this._failMessage(transcriptItem);
        });
  }