mirror of
https://github.com/hexastack/hexabot
synced 2025-06-04 03:26:22 +00:00
fix: update block controller
This commit is contained in:
parent
408d50a5d3
commit
992ae79fc3
@ -93,7 +93,7 @@ export class BlockController extends BaseController<
|
||||
* @returns An array containing the settings of the specified plugin.
|
||||
*/
|
||||
@Get('customBlocks/settings')
|
||||
findSettings(@Query('plugin') pluginName: PluginName) {
|
||||
async findSettings(@Query('plugin') pluginName: PluginName) {
|
||||
try {
|
||||
if (!pluginName) {
|
||||
throw new BadRequestException(
|
||||
@ -110,7 +110,7 @@ export class BlockController extends BaseController<
|
||||
throw new NotFoundException('Plugin Not Found');
|
||||
}
|
||||
|
||||
return plugin.getDefaultSettings();
|
||||
return await plugin.getDefaultSettings();
|
||||
} catch (e) {
|
||||
this.logger.error('Unable to fetch plugin settings', e);
|
||||
throw e;
|
||||
@ -123,7 +123,7 @@ export class BlockController extends BaseController<
|
||||
* @returns An array containing available custom blocks.
|
||||
*/
|
||||
@Get('customBlocks')
|
||||
findAll() {
|
||||
async findAll() {
|
||||
try {
|
||||
const plugins = this.pluginsService
|
||||
.getAllByType(PluginType.block)
|
||||
@ -150,7 +150,7 @@ export class BlockController extends BaseController<
|
||||
typeof p.effects === 'object' ? Object.keys(p.effects) : [],
|
||||
};
|
||||
});
|
||||
return plugins;
|
||||
return await Promise.all(plugins);
|
||||
} catch (e) {
|
||||
this.logger.error(e);
|
||||
throw e;
|
||||
|
Loading…
Reference in New Issue
Block a user