Merge branch 'master' of ssh://git.maxhunt.design:9999/MAX/iot-v2-rn
This commit is contained in:
commit
c588914420
@ -23,7 +23,7 @@ var led_array = {
|
||||
|
||||
|
||||
app.get('/', function (request, responce) {
|
||||
responce.render('index.ejs', {led_array:led_array})
|
||||
responce.render('index.ejs', { led_array: led_array })
|
||||
})
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ app.post('/setlight', async function (request, responce) {
|
||||
|
||||
// Now make an api call to the led controller
|
||||
axios({
|
||||
url: 'http://192.168.0.23:5000/setState',
|
||||
url: 'http://192.168.0.27:5000/setState',
|
||||
method: 'post',
|
||||
data: {
|
||||
power: led_array.power,
|
||||
@ -44,7 +44,29 @@ app.post('/setlight', async function (request, responce) {
|
||||
color: led_array.color
|
||||
}
|
||||
})
|
||||
responce.send({success: true, error: false})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
responce.send({ success: false, error: "NETWORK" })
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
axios({
|
||||
url: 'http://192.168.0.23:5000/setState',
|
||||
method: 'post',
|
||||
data: {
|
||||
power: led_array.power,
|
||||
brightness: led_array.brightness,
|
||||
color: led_array.color
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
responce.send({ success: false, error: "NETWORK" })
|
||||
})
|
||||
.then(() => {
|
||||
responce.send({ success: true, error: false })
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
else {
|
||||
@ -59,7 +81,7 @@ app.post('/getlight', async function (request, responce) {
|
||||
brightness: led_array.brightness,
|
||||
color: led_array.color
|
||||
}
|
||||
responce.send({led_array: rsp})
|
||||
responce.send({ led_array: rsp })
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user