Introduce or Update useCreateLink Hook #226
Labels
Frontend
Frontend Related Issue
⚡Important
High-impact issue that needs to be resolved before the next release
Refactor
Code Improvement
Milestone
Implement a dedicated hook to handle the link creation API call (
POST /api/documents/[documentId]/links
) with typed request and response. Remove directaxios
usage from the component logic, ensuring a DRY approach.Detailed Tasks
Create a Hook under
src/hooks/documentLinks/
(ordocuments/
) nameduseCreateLink.ts
.useMutation
from React Query (Tanstack Query) or similar.CreateDocumentLinkPayload
) plus thedocumentId
.Models
CreateDocumentLinkPayload
, and the response might beDocumentLinkResponse
:Remove Direct
axios
inCreateLink.tsx
useCreateLink
and callcreateLink(payload)
.Example
Acceptance Criteria
useCreateLink
hook insrc/hooks/
.CreateLink.tsx
no longer callsaxios.post
directly.res.link.linkUrl
, etc.The text was updated successfully, but these errors were encountered: