Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Refresh Attachments after successful URL creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ottosichert committed Oct 4, 2017
1 parent 8e11b34 commit 8c8ae04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/components/header/AttachUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ class AttachUrl extends Component {
event.persist();

const {
windowId, documentId, handleClose, dispatch,
windowId, documentId, handleClose, dispatch, fetchAttachments,
} = this.props;
const { url, name } = this.state;

// TODO: Add translations for notifications
createUrlAttachment({ windowId, documentId, url, name }).then(() => {
handleClose(event);
fetchAttachments();

dispatch(addNotification(
// counterpart.translate('window.attachment.url.title'),
Expand Down
20 changes: 12 additions & 8 deletions src/components/header/Attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ class Attachments extends Component {
}

componentDidMount = () => {
const {windowType, docId} = this.props;
this.fetchAttachments();
}

fetchAttachments = () => {
const { windowType, docId } = this.props;

attachmentsRequest('window', windowType, docId)
.then(response => {
this.setState({
data: response.data
}, () => {
this.attachments && this.attachments.focus();
})
attachmentsRequest('window', windowType, docId).then(response => {
this.setState({ data: response.data }, () => {
if (this.attachments) {
this.attachments.focus();
}
});
});
}

toggleAttachmentDelete = (value) => {
Expand Down Expand Up @@ -115,6 +118,7 @@ class Attachments extends Component {
windowId={windowType}
documentId={docId}
handleClose={this.handleCloseAttachUrl}
fetchAttachments={this.fetchAttachments}
/>
)}
</div>
Expand Down

0 comments on commit 8c8ae04

Please sign in to comment.