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.
|
* @returns An array containing the settings of the specified plugin.
|
||||||
*/
|
*/
|
||||||
@Get('customBlocks/settings')
|
@Get('customBlocks/settings')
|
||||||
findSettings(@Query('plugin') pluginName: PluginName) {
|
async findSettings(@Query('plugin') pluginName: PluginName) {
|
||||||
try {
|
try {
|
||||||
if (!pluginName) {
|
if (!pluginName) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
@ -110,7 +110,7 @@ export class BlockController extends BaseController<
|
|||||||
throw new NotFoundException('Plugin Not Found');
|
throw new NotFoundException('Plugin Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugin.getDefaultSettings();
|
return await plugin.getDefaultSettings();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error('Unable to fetch plugin settings', e);
|
this.logger.error('Unable to fetch plugin settings', e);
|
||||||
throw e;
|
throw e;
|
||||||
@ -123,7 +123,7 @@ export class BlockController extends BaseController<
|
|||||||
* @returns An array containing available custom blocks.
|
* @returns An array containing available custom blocks.
|
||||||
*/
|
*/
|
||||||
@Get('customBlocks')
|
@Get('customBlocks')
|
||||||
findAll() {
|
async findAll() {
|
||||||
try {
|
try {
|
||||||
const plugins = this.pluginsService
|
const plugins = this.pluginsService
|
||||||
.getAllByType(PluginType.block)
|
.getAllByType(PluginType.block)
|
||||||
@ -150,7 +150,7 @@ export class BlockController extends BaseController<
|
|||||||
typeof p.effects === 'object' ? Object.keys(p.effects) : [],
|
typeof p.effects === 'object' ? Object.keys(p.effects) : [],
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return plugins;
|
return await Promise.all(plugins);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(e);
|
this.logger.error(e);
|
||||||
throw e;
|
throw e;
|
||||||
|
Loading…
Reference in New Issue
Block a user