@ibm-watson/assistant-intermediate
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "@ibm-watson/assistant-intermediate", | ||
"description": "A simple Node.js based web app which shows how to use the Watson Assistant API to recognize user intents.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "server.js", | ||
@@ -31,2 +31,6 @@ "scripts": { | ||
}, | ||
"engines": { | ||
"node": ">=8.15.0" | ||
}, | ||
"engineStrict": true, | ||
"devDependencies": { | ||
@@ -33,0 +37,0 @@ "babel-eslint": "^10.0.1", |
@@ -6,2 +6,3 @@ // The Api module is designed to handle all interactions with the server | ||
var responsePayload; | ||
var messageEndpoint = '/api/message'; | ||
@@ -31,2 +32,4 @@ | ||
responsePayload = JSON.parse(newPayloadStr); | ||
}, | ||
setErrorPayload: function() { | ||
} | ||
@@ -40,3 +43,3 @@ }; | ||
http.onreadystatechange = function () { | ||
if (http.readyState == XMLHttpRequest.DONE) { | ||
if (http.readyState === XMLHttpRequest.DONE) { | ||
var res = JSON.parse(http.responseText); | ||
@@ -70,5 +73,16 @@ sessionId = res.session_id; | ||
http.setRequestHeader('Content-type', 'application/json'); | ||
http.onreadystatechange = function() { | ||
if (http.readyState === 4 && http.status === 200 && http.responseText) { | ||
http.onreadystatechange = function () { | ||
if (http.readyState === XMLHttpRequest.DONE && http.status === 200 && http.responseText) { | ||
Api.setResponsePayload(http.responseText); | ||
} else if (http.readyState === XMLHttpRequest.DONE && http.status !== 200) { | ||
Api.setErrorPayload({ | ||
'output': { | ||
'generic': [ | ||
{ | ||
'response_type': 'text', | ||
'text': 'I\'m having trouble connecting to the server, please refresh the page' | ||
} | ||
], | ||
} | ||
}); | ||
} | ||
@@ -75,0 +89,0 @@ }; |
@@ -51,2 +51,6 @@ // The ConversationPanel module is designed to handle | ||
}; | ||
Api.setErrorPayload = function (newPayload) { | ||
displayMessage(newPayload, settings.authorTypes.watson); | ||
}; | ||
} | ||
@@ -53,0 +57,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
59145681
14115
5