inviting npubs

This commit is contained in:
counterweight 2025-02-09 19:55:44 +01:00
parent 9c90b75bc0
commit 56121342d6
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
6 changed files with 76 additions and 2 deletions

View file

@ -0,0 +1,28 @@
function acceptInvite() {
const npub = window.nostr.getPublicKey();
console.log("Npub is" + npub);
npub.then(async function (npub) {
try {
const response = await fetch('/api/invited-npub', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"npub": npub
})
});
if (response.ok) {
const data = await response.json();
console.log('invited-npub record created successfully:', data);
} else {
const error = await response.json();
console.error('Failed to create invited-npub record:', error);
}
} catch (error) {
console.error('An error occurred:', error);
}
});
}