diff options
Diffstat (limited to 'vfs/vfs.ts')
| -rw-r--r-- | vfs/vfs.ts | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -23,12 +23,9 @@ export interface Response { export interface VfsOptions { id: string - is_editable: boolean - ListNodes: () => Response - GetNode: (path: string) => Response - UpdateNode: (node: Node) => Response - DeleteNode: (node: Node) => Response + ListNodes: () => IPathNode + OnClickNode(path: string): void } export class Vfs { @@ -43,14 +40,18 @@ export class Vfs { console.log("Vfs: element id", opts.id, "not found") return } + } + + async init() { + if (!this.el) { + return + } - let res = this.opts.ListNodes() - if (res.code != 200) { - console.log("Vfs: ListNodes: ", res.message) + let resPathNode = await this.opts.ListNodes() + if (!resPathNode) { return } - let resPathNode = res.data as IPathNode for (const key in resPathNode) { const value = resPathNode[key] as IVfsNode const node = new VfsNode(value, (node: VfsNode) => { @@ -74,8 +75,7 @@ export class Vfs { onClickNode(this: Vfs, node: VfsNode) { if (!node.is_dir) { - const res = this.opts.GetNode(node.path) - console.log("GetNode: ", res) + this.opts.OnClickNode(node.path) return } this.comPath.open(node) |
