mirror of
https://github.com/edufeed-org/polloer.git
synced 2025-12-09 16:24:31 +00:00
shortid working
This commit is contained in:
parent
1dafc13192
commit
7a0d33fa9d
1 changed files with 7 additions and 5 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue