Pre-Caching Other Folders and Files for Faster Navigation Chapter 7
this.$store.commit('structure', {
path: slug,
data: entries
});
return entries;
})
.catch(error => {
this.isLoading = 'error';
console.log(error);
});
}
return output;
},
/**
* Display the contents of getFolderStructure
* Updates the output to display the folders and folders
*/
displayFolderStructure() {
// Set the app to loading
this.isLoading = true;
// Create an empty object
const structure = {
folders: [],
files: []
}
// Get the structure
this.getFolderStructure(this.path).then(data => {
for (let entry of data) {
// Check ".tag" prop for type
if(entry['.tag'] == 'folder') {
structure.folders.push(entry);
} else {
structure.files.push(entry);
}
}
// Update the data object
this.structure = structure;
this.isLoading = false;
});
},
/**