add login button

This commit is contained in:
liamcottle 2025-02-27 17:50:50 +13:00
parent 32928e3a96
commit af2170e53e

View file

@ -151,7 +151,8 @@
<div class="border bg-gray-50 rounded shadow">
<div class="flex border-b p-2">
<div class="font-semibold my-auto mr-auto">{{ cliContact.advName }}</div>
<div class="my-auto">
<div class="flex my-auto space-x-2">
<div @click="login(cliContact)" class="hover:underline cursor-pointer">Login</div>
<div @click="cliContact = null" class="hover:underline cursor-pointer">Close</div>
</div>
</div>
@ -510,6 +511,28 @@
alert("Failed to get battery voltage!");
}
},
async login(contact) {
// ask user for password
const password = prompt("Please enter Admin, or Guest password");
if(!password){
return;
}
try {
// log in to repeater
const response = await this.connection.login(contact.publicKey, password);
console.log("login response", response);
// show status response
alert(`login response:\n${JSON.stringify(response, null, 4)}`);
} catch(e) {
alert(`Failed to login: ${e}`);
}
},
async statusRequest(contact) {
// ask user for password