Feed - posts #227
@ -6,15 +6,19 @@ import { log, LogType } from 'utils'
|
|||||||
export const commentsLoader =
|
export const commentsLoader =
|
||||||
(ndkContext: NDKContextType) =>
|
(ndkContext: NDKContextType) =>
|
||||||
async ({ params }: LoaderFunctionArgs) => {
|
async ({ params }: LoaderFunctionArgs) => {
|
||||||
const { nevent } = params
|
const { nevent, note } = params
|
||||||
|
const target = nevent || note
|
||||||
if (!nevent) {
|
if (!target) {
|
||||||
log(true, LogType.Error, 'Required nevent.')
|
log(
|
||||||
|
true,
|
||||||
|
LogType.Error,
|
||||||
|
'Missing event parameter in the URL (nevent, note).'
|
||||||
|
)
|
||||||
return redirect('..')
|
return redirect('..')
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const replyEvent = await ndkContext.ndk.fetchEvent(nevent)
|
const replyEvent = await ndkContext.ndk.fetchEvent(target)
|
||||||
|
|
||||||
if (!replyEvent) {
|
if (!replyEvent) {
|
||||||
throw new Error('We are unable to find the comment on the relays')
|
throw new Error('We are unable to find the comment on the relays')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user