Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
Fix exception when uploading from index view
Browse files Browse the repository at this point in the history
  • Loading branch information
Marttin Notta committed Apr 19, 2021
1 parent 92fc0ab commit 6765cb4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions resources/js/components/IndexButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:activeFile.sync="activeFile"
:showUploadArea.sync="showUploadArea"
@updateFiles="updateFiles"
@updateMedia="updateMedia"
:loadingMediaFiles.sync="loadingMediaFiles"
:selectedFiles.sync="selectedFiles"
/>
Expand Down Expand Up @@ -71,6 +72,7 @@ export default {
updateMedia: debounce(function () {
this.onUploadFinished();
this.isModalOpen = false;
this.$toasted.show('Files have been successfully uploaded!', { type: 'success' });
}, 1000),
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/MediaBrowsingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,15 @@ export default {
},
})
.then(response => {
if (!window.mediaLibrary.files.find(file => file.data?.id && file.data.id === response.data.id)) {
if (!window.mediaLibrary?.files?.find(file => file.data?.id && file.data.id === response.data.id)) {
if (this.uploadOnly) {
this.$emit('updateFiles', {
uploading: false,
processed: true,
data: response.data,
});
} else {
window.mediaLibrary.files.unshift({
window.mediaLibrary?.files.unshift({
uploading: false,
processed: true,
data: response.data,
Expand Down

0 comments on commit 6765cb4

Please sign in to comment.