mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
add login button
This commit is contained in:
parent
32928e3a96
commit
af2170e53e
1 changed files with 24 additions and 1 deletions
25
index.html
25
index.html
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue