buttercat1791 12 months ago
parent
commit
4292cf3b13
  1. 12
      src/routes/publication/+page.ts
  2. 3
      tsconfig.json
  3. 6
      vite.config.ts

12
src/routes/publication/+page.ts

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
import { error } from '@sveltejs/kit';
import { NDKRelay, NDKRelaySet, type NDKEvent } from '@nostr-dev-kit/ndk';
import type { NDKEvent } from '@nostr-dev-kit/ndk';
import type { PageLoad } from './$types';
import { get } from 'svelte/store';
import { getActiveRelays, inboxRelays, ndkInstance } from '$lib/ndk';
import { standardRelays } from '$lib/consts';
import { getActiveRelays } from '$lib/ndk.ts';
import { setContext } from 'svelte';
import { PublicationTree } from '$lib/data_structures/publication_tree.ts';
export const load: PageLoad = async ({ url, parent }) => {
export const load: PageLoad = async ({ url, parent }: { url: URL; parent: () => Promise<any> }) => {
const id = url.searchParams.get('id');
const dTag = url.searchParams.get('d');
@ -41,6 +41,8 @@ export const load: PageLoad = async ({ url, parent }) => { @@ -41,6 +41,8 @@ export const load: PageLoad = async ({ url, parent }) => {
const publicationType = indexEvent?.getMatchingTags('type')[0]?.[1];
const fetchPromise = parser.fetch(indexEvent);
setContext('publicationTree', new PublicationTree(indexEvent, ndk));
return {
waitable: fetchPromise,
publicationType,

3
tsconfig.json

@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
"strict": true,
"allowImportingTsExtensions": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//

6
vite.config.ts

@ -3,6 +3,12 @@ import { defineConfig } from "vite"; @@ -3,6 +3,12 @@ import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit()],
resolve: {
alias: {
$lib: './src/lib',
$components: './src/components'
}
},
test: {
include: ['./tests/unit/**/*.unit-test.js']
}

Loading…
Cancel
Save