refactor: parse reposted event from content
This commit is contained in:
parent
b490f6c190
commit
751ad16690
1 changed files with 3 additions and 5 deletions
|
|
@ -1,13 +1,11 @@
|
|||
import { Event } from 'nostr-tools'
|
||||
import { useFetchEventById } from '@renderer/hooks'
|
||||
import { Repeat2 } from 'lucide-react'
|
||||
import { Event, verifyEvent } from 'nostr-tools'
|
||||
import Username from '../Username'
|
||||
import ShortTextNoteCard from './ShortTextNoteCard'
|
||||
|
||||
export default function RepostNoteCard({ event, className }: { event: Event; className?: string }) {
|
||||
const targetEventId = event.tags.find(([tagName]) => tagName === 'e')?.[1]
|
||||
const targetEvent = useFetchEventById(targetEventId)
|
||||
if (!targetEvent) return null
|
||||
const targetEvent = event.content ? (JSON.parse(event.content) as Event) : null
|
||||
if (!targetEvent || !verifyEvent(targetEvent)) return null
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue