mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-11-26 09:56:20 -05:00
add button to dropdown menu to ping destination
This commit is contained in:
parent
b0abe2122d
commit
647ee32c87
2 changed files with 33 additions and 4 deletions
|
|
@ -19,6 +19,14 @@
|
|||
</DropDownMenuItem>
|
||||
</a>
|
||||
|
||||
<!-- ping button -->
|
||||
<DropDownMenuItem @click="onPingDestination">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-5">
|
||||
<path fill-rule="evenodd" d="M14.615 1.595a.75.75 0 0 1 .359.852L12.982 9.75h7.268a.75.75 0 0 1 .548 1.262l-10.5 11.25a.75.75 0 0 1-1.272-.71l1.992-7.302H3.75a.75.75 0 0 1-.548-1.262l10.5-11.25a.75.75 0 0 1 .913-.143Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Ping Destination</span>
|
||||
</DropDownMenuItem>
|
||||
|
||||
<!-- set custom display name button -->
|
||||
<DropDownMenuItem @click="onSetCustomDisplayName">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-5">
|
||||
|
|
@ -84,6 +92,25 @@ export default {
|
|||
async onSetCustomDisplayName() {
|
||||
this.$emit("set-custom-display-name");
|
||||
},
|
||||
async onPingDestination() {
|
||||
try {
|
||||
|
||||
// ping destination
|
||||
const response = await window.axios.get(`/api/v1/ping/${this.peer.destination_hash}/lxmf.delivery`, {
|
||||
params: {
|
||||
timeout: 30,
|
||||
},
|
||||
});
|
||||
|
||||
// show result
|
||||
DialogUtils.alert(response.data.message);
|
||||
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
const message = e.response?.data?.message ?? "Ping failed. Try again later";
|
||||
DialogUtils.alert(message);
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue