|
@@ -1,15 +1,27 @@
|
|
|
import axios from "axios"
|
|
import axios from "axios"
|
|
|
import { WebSocket } from "ws"
|
|
import { WebSocket } from "ws"
|
|
|
|
|
+// const {
|
|
|
|
|
+// data: { access_token }
|
|
|
|
|
+// } = await axios.post("http://47.98.225.28/api/auth/admin/login", {
|
|
|
|
|
+// username: "zoumaAdmin",
|
|
|
|
|
+// password: "WQ%B6j9uXKPvYf",
|
|
|
|
|
+// code: "123123",
|
|
|
|
|
+// bindingCode: ""
|
|
|
|
|
+// })
|
|
|
const {
|
|
const {
|
|
|
data: { access_token }
|
|
data: { access_token }
|
|
|
-} = await axios.post("http://47.98.225.28/api/auth/admin/login", {
|
|
|
|
|
- username: "zoumaAdmin",
|
|
|
|
|
- password: "WQ%B6j9uXKPvYf",
|
|
|
|
|
|
|
+} = await axios.post("http://8.149.128.251/api/auth/admin/login", {
|
|
|
|
|
+ username: "admin",
|
|
|
|
|
+ password: "r&po^a9$Nc2AP9",
|
|
|
code: "123123",
|
|
code: "123123",
|
|
|
bindingCode: ""
|
|
bindingCode: ""
|
|
|
})
|
|
})
|
|
|
const axiosInstance = axios.create({
|
|
const axiosInstance = axios.create({
|
|
|
- baseURL: "http://47.98.225.28/api",
|
|
|
|
|
|
|
+ // baseURL: "http://47.98.225.28/api",
|
|
|
|
|
+ // headers: {
|
|
|
|
|
+ // Authorization: `Bearer ${access_token}`
|
|
|
|
|
+ // }
|
|
|
|
|
+ baseURL: "http://8.149.128.251/api",
|
|
|
headers: {
|
|
headers: {
|
|
|
Authorization: `Bearer ${access_token}`
|
|
Authorization: `Bearer ${access_token}`
|
|
|
}
|
|
}
|
|
@@ -35,6 +47,7 @@ ws.onopen = () => {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
console.log("Updating device names")
|
|
console.log("Updating device names")
|
|
|
|
|
+ console.log(xwDevices)
|
|
|
if (xwDevices.length > 0) {
|
|
if (xwDevices.length > 0) {
|
|
|
let i = 101
|
|
let i = 101
|
|
|
for (let device of devices) {
|
|
for (let device of devices) {
|
|
@@ -53,7 +66,7 @@ ws.onopen = () => {
|
|
|
action: "updateDevices",
|
|
action: "updateDevices",
|
|
|
devices: xwDevice.serial,
|
|
devices: xwDevice.serial,
|
|
|
data: {
|
|
data: {
|
|
|
- sort: i++,
|
|
|
|
|
|
|
+ // sort: i++,
|
|
|
name: device.name
|
|
name: device.name
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|