mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-01 04:16:45 -05:00
update path to peer when a message is sent or received
This commit is contained in:
parent
940cf7bbd1
commit
382a880a29
1 changed files with 13 additions and 9 deletions
|
|
@ -449,7 +449,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
this.getPeerPath(this.selectedPeer.destination_hash);
|
||||
this.getPeerPath();
|
||||
|
||||
// load 1 page of previous messages
|
||||
await this.loadPrevious();
|
||||
|
|
@ -520,10 +520,12 @@ export default {
|
|||
switch(json.type){
|
||||
case 'lxmf.delivery': {
|
||||
this.onLxmfMessageReceived(json.lxmf_message);
|
||||
await this.getPeerPath();
|
||||
break;
|
||||
}
|
||||
case 'lxmf_message_created': {
|
||||
this.onLxmfMessageCreated(json.lxmf_message);
|
||||
await this.getPeerPath();
|
||||
break;
|
||||
}
|
||||
case 'lxmf_message_state_updated': {
|
||||
|
|
@ -601,21 +603,23 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
async getPeerPath(destinationHash) {
|
||||
async getPeerPath() {
|
||||
|
||||
// clear previous known path
|
||||
this.selectedPeerPath = null;
|
||||
|
||||
try {
|
||||
if(this.selectedPeer){
|
||||
try {
|
||||
|
||||
// get path to destination
|
||||
const response = await window.axios.get(`/api/v1/destination/${destinationHash}/path`);
|
||||
// get path to destination
|
||||
const response = await window.axios.get(`/api/v1/destination/${this.selectedPeer.destination_hash}/path`);
|
||||
|
||||
// update ui
|
||||
this.selectedPeerPath = response.data.path;
|
||||
// update ui
|
||||
this.selectedPeerPath = response.data.path;
|
||||
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue