shortid working

This commit is contained in:
@s.roertgen 2025-04-29 21:42:40 +02:00
parent 1dafc13192
commit 7a0d33fa9d

View file

@ -14,14 +14,16 @@
let sessionId = ''; let sessionId = '';
async function joinSession() { async function joinSession() {
console.log('join ' + questionShortId); console.log('join ' + sessionId);
const filter = { const filter = {
kinds: [2222], kinds: [1342],
'#d': [questionShortId + ''], // filter by `d` tag '#d': [sessionId + ''], // filter by `d` tag
limit: 1
}; };
console.log(filter)
const question = await $ndk.fetchEvent(filter); const question = await $ndk.fetchEvent(filter);
console.log('question', question);
goto('/q/' + question.id); goto('/q/' + question.id);
login()
} }
async function postQuestion() { async function postQuestion() {
questionShortId = 10000000 + Math.floor(Math.random() * 90000000); questionShortId = 10000000 + Math.floor(Math.random() * 90000000);
@ -92,7 +94,7 @@
{#if $connected} {#if $connected}
<div class="join"> <div class="join">
<input type="number" class="border p-2" placeholder="Session id" bind:value={sessionId} /> <input type="number" class="border p-2" placeholder="Session id" bind:value={sessionId} />
<button class="btn btn-primary rounded" onclick={joinSession}> Join </button> <button class="btn btn-primary rounded" onclick={() => joinSession()}> Join </button>
</div> </div>
{/if} {/if}
</div> </div>