-
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.
Browse files
Browse the repository at this point in the history
* feat : study api 추가 * feat : api fetch 이름 삭제 * feat : 학습자료 crud api 제작 * feat : Document 타입지정 * feat : documentAccessType, documentType 형식 지정 --------- Co-authored-by: 김문경 <>
- Loading branch information
1 parent
692c92d
commit 2bcc55e
Showing
2 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { fetcher } from '@/app/api/fetcher'; | ||
import { Document, DocumentType } from '@/types'; | ||
|
||
const documentFetcher = fetcher(); | ||
|
||
const postDocument = (groupType: number, groupId: number, document: Document, files: FormData) => { | ||
documentFetcher(`/${groupType}/${groupId}/documents`, { | ||
method: 'POST', | ||
body: { document, files }, | ||
}); | ||
}; | ||
|
||
const getDocumentList = (groupType: number, groupId: number, page: number = 0, size: number = 4) => { | ||
documentFetcher(`/${groupType}/${groupId}/documents?page=${page}&size=${size}`, { | ||
method: 'GET', | ||
}); | ||
}; | ||
|
||
const getDocument = (documentId: number) => { | ||
documentFetcher(`/${documentId}`, { | ||
method: 'GET', | ||
}); | ||
}; | ||
|
||
const putDocument = (documentId: number, title: string, description: string, accessType: DocumentType) => { | ||
documentFetcher(`/${documentId}`, { | ||
method: 'PUT', | ||
body: { | ||
title, | ||
description, | ||
accessType, | ||
}, | ||
}); | ||
}; | ||
|
||
const deleteDocument = (documentId: number) => { | ||
documentFetcher(`/${documentId}`, { | ||
method: 'DELETE', | ||
}); | ||
}; | ||
|
||
export { postDocument, getDocumentList, getDocument, putDocument, deleteDocument }; |
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