From 2faefbbd3e74d96363984d73ecd73122a64fa902 Mon Sep 17 00:00:00 2001 From: cheetah Date: Sat, 10 Dec 2022 22:17:32 +0100 Subject: [PATCH] optimized api call path --- html_config/index.html | 6 +++--- html_main/index.html | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/html_config/index.html b/html_config/index.html index f7f4bbe..822c9c5 100644 --- a/html_config/index.html +++ b/html_config/index.html @@ -381,7 +381,7 @@ }, methods: { loadConfig() { - this.$http.get('/config').then(response => { + this.$http.get('config').then(response => { const newConfig = response.body Object.keys(newConfig.deliveryPresets) .map(_key => { @@ -407,9 +407,9 @@ return total }, {}) - this.$http.post('/config', storeConfig).then(response => { + this.$http.post('config', storeConfig).then(response => { }) - .then(this.$http.post('/restart')) + .then(this.$http.post('restart')) .then(() => { document.body.style = 'display:none' setTimeout(() => window.location.reload(), 1e3) diff --git a/html_main/index.html b/html_main/index.html index 4a0e37f..53d0a79 100644 --- a/html_main/index.html +++ b/html_main/index.html @@ -257,7 +257,7 @@ Last LoRaWAN Packet: this.refreshMessages() setInterval(this.refreshMessages, 1e3) - this.$http.get('/api/deliveryPresets') + this.$http.get('api/deliveryPresets') .then(response => { console.log(response.body) this.presetSearchItems = response.body.map(x => { return { @@ -270,7 +270,7 @@ Last LoRaWAN Packet: }, methods: { refreshDevices() { - this.$http.get('/api/devices').then(response => { + this.$http.get('api/devices').then(response => { this.deviceListData = Object.keys(response.body).map(key => { const item = response.body[ key ] const keyData = key.split(':') @@ -286,7 +286,7 @@ Last LoRaWAN Packet: }) }, refreshMessages() { - this.$http.get('/api/message/recent').then(response => { + this.$http.get('api/message/recent').then(response => { this.recentMessageListData = response.body.map(msg => { const stateArray = [msg._routerData.recvAck, msg._routerData.readAck, msg._routerData.response] // msg.state = [ msg.type, stateArray.filter(x=>x!==false).length, ...stateArray ] @@ -299,6 +299,7 @@ Last LoRaWAN Packet: case 3: msg.state = '💬 Responded'; break; } } + if (msg._routerData.failed === true) msg.state = '❌ Failed' msg.date = new Date(msg.date).toLocaleString('de') return msg }) @@ -308,7 +309,7 @@ Last LoRaWAN Packet: }, apiACKMessage(id, ackType) { this.$http.get( - '/api/message/ack/'+[ackType, id].join('/') + 'api/message/ack/'+[ackType, id].join('/') ).then(x=>{}) }, testMsg_addDeliveryTarget() { @@ -316,14 +317,14 @@ Last LoRaWAN Packet: }, testMsg_send() { if (this.EXPERTMODE) { - this.$http.post('/api/message/advanced/', + this.$http.post('api/message/advanced/', Object.assign({ ...this.newMSGData.pager.params }, { payload: this.newMSGData.pager.payload }) ).then(x=>{ this.dialogNewMessage = false }) } else { console.log(this.newMSGData.preset) - this.$http.post('/api/message/preset/', + this.$http.post('api/message/preset/', Object.assign({ preset: this.newMSGData.preset }, { payload: this.newMSGData.pager.payload }) ).then(x=>{ this.dialogNewMessage = false