Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. app.intent(QUESTIONS_INTENT, (conv, params) => {
  2. let data = conv.data;
  3.  
  4. let categoryId = data.categoryId;
  5. let formulas = data.formulas;
  6. let options = {
  7. 'method': 'PUT',
  8. 'url': apiUrl + 'questions/filter',
  9. 'body': {
  10. categoryId: categoryId,
  11. organisationId: organisation,
  12. formulas: formulas
  13. },
  14. 'json': true
  15. };
  16.  
  17.  
  18. return request(options).then(response => {
  19.  
  20. // We need to change how we get these
  21. var questionText = params.questions;
  22. var questions = response.filter(item => item.text === questionText);
  23.  
  24. data.questions = questions;
  25. conv.ask(questions[0].text);
  26. conv.contexts.set('colour');
  27. }, error => {
  28. conv.ask(JSON.stringify(error));
  29. });
  30. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement