Feed - posts #227

Merged
enes merged 23 commits from feat/131-feed-posts into staging 2025-02-14 19:54:29 +00:00
Showing only changes of commit c6da42caf0 - Show all commits

View File

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