Skip to content

Commit

Permalink
updated action goto
Browse files Browse the repository at this point in the history
  • Loading branch information
khanh1902 committed Jul 6, 2024
1 parent 94999a1 commit 4e207e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions actions/Goto.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { ComponentDialog, WaterfallDialog } = require('botbuilder-dialogs');
const { GO_TO } = require('../Constant');
const { endConversation } = require('../utils/utils');
const { ERROR_MESSAGE } = process.env;

const GOTOACTION_WATERFALL = 'GOTOACTION_WATERFALL';

Expand All @@ -8,15 +10,18 @@ class GotoAction extends ComponentDialog {
super(GO_TO);
this.dialog = dialog;
this.addDialog(
new WaterfallDialog(GOTOACTION_WATERFALL, [
this.goto.bind(this),
])
new WaterfallDialog(GOTOACTION_WATERFALL, [this.goto.bind(this)])
);
this.initialDialogId = GOTOACTION_WATERFALL;
}

async goto(step) {
const { gotoId } = step.step._info.options;
const { gotoId } = step._info.options;

if (!gotoId) {
return await endConversation(step, ERROR_MESSAGE);
}

return await step.endDialog({ actionId: gotoId });
}
}
Expand Down
2 changes: 1 addition & 1 deletion actions/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class MainDialog extends ComponentDialog {
'sub-flow': SUB_FLOW,
'check-variables': CHECK_VARIABLE,
'send-mail': SEND_MAIL,
'goto"': GO_TO
'goto': GO_TO
};

if (!actions[action]) {
Expand Down

0 comments on commit 4e207e2

Please sign in to comment.