({
threadId,
currentUserId,
authorId,
parentId,
isComment,
}: Props)
| 14 | } |
| 15 | |
| 16 | function DeleteThread({ |
| 17 | threadId, |
| 18 | currentUserId, |
| 19 | authorId, |
| 20 | parentId, |
| 21 | isComment, |
| 22 | }: Props) { |
| 23 | const pathname = usePathname(); |
| 24 | const router = useRouter(); |
| 25 | |
| 26 | if (currentUserId !== authorId || pathname === "/") return null; |
| 27 | |
| 28 | return ( |
| 29 | <Image |
| 30 | src='/assets/delete.svg' |
| 31 | alt='delte' |
| 32 | width={18} |
| 33 | height={18} |
| 34 | className='cursor-pointer object-contain' |
| 35 | onClick={async () => { |
| 36 | await deleteThread(JSON.parse(threadId), pathname); |
| 37 | if (!parentId || !isComment) { |
| 38 | router.push("/"); |
| 39 | } |
| 40 | }} |
| 41 | /> |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | export default DeleteThread; |
nothing calls this directly
no test coverage detected
searching dependent graphs…