feat: add imeta tags
This commit is contained in:
parent
3e609f7236
commit
50658f6d91
3 changed files with 41 additions and 16 deletions
|
|
@ -6,9 +6,9 @@ import { useRef, useState } from 'react'
|
|||
import { z } from 'zod'
|
||||
|
||||
export default function Uploader({
|
||||
setContent
|
||||
onUploadSuccess
|
||||
}: {
|
||||
setContent: React.Dispatch<React.SetStateAction<string>>
|
||||
onUploadSuccess: ({ url, tags }: { url: string; tags: string[][] }) => void
|
||||
}) {
|
||||
const [uploading, setUploading] = useState(false)
|
||||
const { signHttpAuth } = useNostr()
|
||||
|
|
@ -42,7 +42,7 @@ export default function Uploader({
|
|||
const tags = z.array(z.array(z.string())).parse(data.nip94_event?.tags ?? [])
|
||||
const imageUrl = tags.find(([tagName]) => tagName === 'url')?.[1]
|
||||
if (imageUrl) {
|
||||
setContent((prevContent) => `${prevContent}\n${imageUrl}`)
|
||||
onUploadSuccess({ url: imageUrl, tags })
|
||||
} else {
|
||||
throw new Error('No image url found')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue