Skip to content

Commit

Permalink
use luUtil api
Browse files Browse the repository at this point in the history
  • Loading branch information
liweitian committed Jan 16, 2020
1 parent ad08d2a commit 1d5f59e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
getActivityTypes,
getMessageTypes,
} from '../../utils/dialogUtil';
import { addIntent } from '../../utils/luUtil';
import { StoreContext } from '../../store';

import { styles, dropdownStyles, dialogWindow, intent, triggerPhrases } from './styles';
Expand Down Expand Up @@ -100,13 +101,13 @@ export const TriggerCreationModal: React.FC<TriggerCreationModalProps> = props =
});
return;
}
const newContent = get(luFile, 'content', '') + '\n\n' + '# ' + formData.intent + '\n' + formData.triggerPhrases;

const content = get(luFile, 'content', '');
const newContent = addIntent(content, { Name: formData.intent, Body: formData.triggerPhrases });
const updateLuFile = {
id: dialogId,
content: newContent,
};

const newDialog = addNewTrigger(dialogs, dialogId, formData);
onSubmit(newDialog, updateLuFile);
onDismiss();
Expand Down

0 comments on commit 1d5f59e

Please sign in to comment.