Я создаю SPA на Vue (что-то вроде облачного диска), используя компонент
loadNode: async function (node, resolve) {
try {
let firstGeneration = await foldersAPI.get(this.$store.state.user.myDrive);
if (node.level === 0) {
return resolve(firstGeneration.data.folder.children);
} else {
var data;
if (node.data.hasChildren) {
let children = await foldersAPI.get(node.data._id);
console.log(children);
data = children.data.folder.children;
} else {
data = [];
}
resolve(data);
}
} catch (e) {
console.log(e)
}