Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1

Caching the Current Folder Structure Using Vuex Chapter 6


return new Dropbox({
accessToken: this.accessToken
});
},
getFolderStructure() {
this.dropbox().filesListFolder({
path: this.path,
include_media_info: true
})
.then(response => {
const structure = {
folders: [],
files: []
}
for (let entry of response.entries) {
// Check ".tag" prop for type
if(entry['.tag'] == 'folder') {
structure.folders.push(entry);
} else {
structure.files.push(entry);
}
}
this.structure = structure;
this.isLoading = false;
})
.catch(error => {
this.isLoading = 'error';
console.log(error);
});
},
updateStructure() {
this.isLoading = true;
this.getFolderStructure();
}
},
created() {
this.getFolderStructure();
},
watch: {
path() {
this.updateStructure();
}
},
});
Free download pdf