forked from picktoss/pick-toss-next
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: document card check * feat: query client for storybook * fix: merge and fix error * feat: directory id에 따른 documents 가져오기 + queries 적용 * fix: 불필요한 코드 삭제 * fix: build error * fix: import * fix: storybook * fix: expend buttons bug * fix: document markdown debugging * refactor: document type * refactor: 타입명 수정 * fix: modify document * fix: merge * feat: move document * fix: default(기본 폴더) => 전체 노트 * feat: delete document & move document refactoring + fix: directory globar directory * fix: mutation * feat: update directory * fix: update document
- Loading branch information
1 parent
0ae204e
commit 5d2933c
Showing
4 changed files
with
59 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use client' | ||
|
||
import { API_ENDPOINTS } from '@/shared/configs/endpoint' | ||
import { http } from '@/shared/lib/axios/http' | ||
|
||
export const updateDocument = async ( | ||
documentId: number, | ||
requestBody: Document.Request.UpdateContent, | ||
accessToken: string | ||
) => { | ||
const formData = new FormData() | ||
|
||
const blob = new Blob([requestBody.file], { type: 'text/markdown' }) | ||
const file = new File([blob], `${requestBody.name}.md`, { type: 'text/markdown' }) | ||
|
||
formData.append('file', file) | ||
formData.append('name', requestBody.name) | ||
|
||
try { | ||
const response = await http.patch( | ||
API_ENDPOINTS.DOCUMENT.PATCH.UPDATE_CONTENT(documentId), | ||
formData, | ||
{ | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
} | ||
) | ||
|
||
// eslint-disable-next-line no-console | ||
console.log(response) // 디버깅용 | ||
} catch (error: unknown) { | ||
throw error | ||
} | ||
} |