Commit d1bff179 authored by Nicolai Grymer's avatar Nicolai Grymer 🐤
Browse files

Fixing error message

parent 3dc33c7c
......@@ -116,12 +116,17 @@ function sendData(url, data){
if(!errorState){
axios.put(url, data, {timeout: 4000})
.then(function (response) {
if(JSON.parse(response)[0].success === undefined){
errMessage('Connected to the bridge, but did not find bulb! Please check');
ErrOneLine('>>> You use the right bulb ID!');
ErrOneLine('>>> Your bulb has power');
errBar();
triggerErrorState();
if(response.data[0].success === undefined){
if(response.data[0].error !== undefined && response.data[0].error.type === 201){
errMessage('Bulb is turned off. Cannot change parameters of turned off bulb');
} else {
errMessage('Connected to the bridge, but did not find bulb! Please check');
errOneLine('>>> You use the right bulb ID!');
errOneLine('>>> Your bulb has power');
errBar();
triggerErrorState();
}
} else {
console.log('\x1b[32m', '--- SUCCESSFUL TRANSFER ---', '\x1b[0m');
}
......
......@@ -9,6 +9,6 @@
},
"dependencies": {
"axios": "0.20.0",
"serialport": "9.0.1"
"serialport": "9.0.2"
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment