Refresh previews on data change

pull/37/head
Varun Patil 2022-08-20 08:32:32 +00:00
parent 2662225f0f
commit 89f044f125
3 changed files with 31 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,18 @@ export default {
}
},
mounted() {
this.refreshPreviews();
},
watch: {
data: {
handler() {
this.refreshPreviews();
},
},
},
methods: {
/** Refresh previews */
refreshPreviews() {
if (!this.data.previewFileInfos) {
const folderPath = this.data.path.split('/').slice(3).join('/');
dav.getFolderPreviewFileIds(folderPath, 4).then(fileInfos => {
@ -52,13 +64,13 @@ export default {
this.previewFileInfos = fileInfos;
}).catch(() => {
this.data.previewFileInfos = [];
this.previewFileInfos = [];
});
} else {
this.previewFileInfos = this.data.previewFileInfos;
}
},
methods: {
/** Open album folder */
openFolder(id) {
this.$router.push({ name: 'albums', params: { id } });