rework context

This commit is contained in:
Jon Staab
2024-09-05 13:38:48 -07:00
parent 233a4e3576
commit 44f29c9da4
19 changed files with 157 additions and 138 deletions
+4 -5
View File
@@ -1,9 +1,8 @@
import {writable, derived} from 'svelte/store'
import {withGetter} from '@welshman/store'
import {groupBy, indexBy, batch, now, uniq, uniqBy, batcher, postJson} from '@welshman/lib'
import {type RelayProfile} from "@welshman/util"
import {ctx, groupBy, indexBy, batch, now, uniq, uniqBy, batcher, postJson} from '@welshman/lib'
import type {RelayProfile} from "@welshman/util"
import {AuthStatus, asMessage, type Connection, type SocketMessage} from '@welshman/net'
import {AppContext} from './core'
import {createSearch} from './util'
import {collection} from './collection'
@@ -45,10 +44,10 @@ export const relaysByPubkey = derived(relays, $relays =>
)
export const fetchRelayProfiles = (urls: string[]) => {
const base = AppContext.dufflepudUrl!
const base = ctx.app.dufflepudUrl!
if (!base) {
throw new Error("AppContext.dufflepudUrl is required to fetch relay metadata")
throw new Error("ctx.app.dufflepudUrl is required to fetch relay metadata")
}
const res: any = postJson(`${base}/relay/info`, {urls})