fix(data-source): 执行时机函数需要await

This commit is contained in:
roymondchen 2024-12-03 14:59:44 +08:00
parent da12ef9d8d
commit 64a692b32a

View File

@ -112,18 +112,18 @@ class DataSourceManager extends EventEmitter {
for (const method of ds.methods) {
if (typeof method.content !== 'function') return;
if (method.timing === 'beforeInit') {
method.content({ params: {}, dataSource: ds, app: this.app });
await method.content({ params: {}, dataSource: ds, app: this.app });
}
}
await ds.init();
ds.methods.forEach((method) => {
for (const method of ds.methods) {
if (typeof method.content !== 'function') return;
if (method.timing === 'afterInit') {
method.content({ params: {}, dataSource: ds, app: this.app });
await method.content({ params: {}, dataSource: ds, app: this.app });
}
});
}
}
public get(id: string) {