11 changed files with 75 additions and 28 deletions
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
<script lang="ts"> |
||||
import {ndk} from '$lib/ndk'; |
||||
import { page } from '$app/stores'; |
||||
import Article from '$lib/Article.svelte'; |
||||
import {idList} from '$lib/stores'; |
||||
import {nip19} from 'nostr-tools'; |
||||
// const id = nip19.decode($page.params.path).data; |
||||
|
||||
|
||||
|
||||
</script> |
||||
<Article /> |
||||
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
<script lang="ts"> |
||||
import Article from '$lib/Article.svelte'; |
||||
import type { PageData } from './$types'; |
||||
|
||||
export let data: PageData; |
||||
</script> |
||||
|
||||
<main> |
||||
<Article event={data.event} /> |
||||
</main> |
||||
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
import { getNdkInstance, ndk } from '$lib/ndk'; |
||||
|
||||
export const load = async ({ params }) => { |
||||
// TODO: Don't rely on browser cache here.
|
||||
const ndk = getNdkInstance(); |
||||
const { id } = params; |
||||
|
||||
// TODO: Add error handling.
|
||||
const event = await ndk.fetchEvent(id); |
||||
|
||||
return { event }; |
||||
}; |
||||
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
<script lang="ts"> |
||||
import Article from '$lib/Article.svelte'; |
||||
import type { PageData } from './$types'; |
||||
|
||||
export let data: PageData; |
||||
</script> |
||||
|
||||
<main> |
||||
<Article event={data.event} /> |
||||
</main> |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
import { getNdkInstance } from "$lib/ndk"; |
||||
|
||||
export const load = async ({ params }) => { |
||||
// TODO: Don't rely on browser cache here.
|
||||
const ndk = getNdkInstance(); |
||||
const { tag } = params; |
||||
|
||||
// TODO: Add error handling.
|
||||
const events = await ndk.fetchEvents({ '#d': [tag] }); |
||||
const event = events.values().next().value; |
||||
|
||||
return { event }; |
||||
}; |
||||
Loading…
Reference in new issue