Initial support for random 'next', 'action', ...

This commit is contained in:
Bryan Ashby 2019-09-03 19:52:04 -06:00
parent 1e08810188
commit 16f4d62548
No known key found for this signature in database
GPG key ID: B49EB437951D2542
2 changed files with 37 additions and 4 deletions

View file

@ -7,6 +7,9 @@ const {
Errors,
ErrorReasons
} = require('./enig_error.js');
const {
getResolvedSpec
} = require('./menu_util.js');
// deps
const _ = require('lodash');
@ -53,7 +56,7 @@ module.exports = class MenuStack {
next(cb) {
const currentModuleInfo = this.top();
const menuConfig = currentModuleInfo.instance.menuConfig;
const nextMenu = this.client.acs.getConditionalValue(menuConfig.next, 'next');
const nextMenu = getResolvedSpec(this.client, menuConfig.next, 'next');
if(!nextMenu) {
return cb(Array.isArray(menuConfig.next) ?
Errors.MenuStack('No matching condition for "next"', ErrorReasons.NoConditionMatch) :