Skip to content

Remove file from widget after upload. #254

Open
@stevesizer

Description

@stevesizer

I'm using the widget api to open the dialog and then on file change creating my object to save to the database. After I have uploaded the image I am trying to remove it from widget using the getInput function.

This is not removing the image. So when I go to reopen the widget the last image uploaded is in preview mode. ANy help would be appreciated. Here is my code below.

const fileChange = (fileInfo) => {
let newAttachment = {
name: fileInfo.name,
file_type: fileInfo.mimeType,
size: fileInfo.size,
attachment_url: fileInfo.cdnUrl,
};

let newMessage = { ...props.message };
newMessage.attachments_attributes.push(newAttachment);
props.updateAttachment(newMessage);
props.postMessage(conversation.id);
let fileInput = widgetApi.current.getInput();
fileInput.value = null;

};

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions