-
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 : 버튼 클릭시 모달 오픈 연결 * feat : 파일 받아오는거까지 확인 * feat : api 전송 확인 * feat : 팀 페이지에서 카테고리 변경시 데이터 받아와지지 않는 문제 해결 * feat : 주석처리 * feat : img, url 전송 확인, 근데 file 전송 실패 이유는 잘 모르겠음... * feat : 학습자료카드 bookmark정보 삭제 / mocks와 DTO 형식 통일 * feat : getDocumentList 성공 * feat : 학습자료 post teamId 적용 * feat : 팀페이지 + 버튼 누르면 모달창 오픈 - 팀 id 다를때에도 제대로 들어오는거 확인됨 * feat : 학습자료 상세 페이지 get 완료 * refactor : 주석정리 * feat : 스터디 / 팀별 학습자료 post, get 확인 * feat : 미리보기 img 준비 * feat : 팀 페이지 학습자료 페이지 생성 + delete api 전송 확인 - delete 이후 페이지 update 필요 * api : getDocumentList api 수정 반영 완료 + page navigator 작동 확인 * feat : put Document api 정리 * feat : 수정 버튼 클릭시 수정 모달 open * feat : 학습자료 api 무한요청 => useEffect 수정 * feat : console 정리 * feat : put 수정 확인 : 화면 update 필요 * feat : 미리보기 이미지 적용 * feat : mocks 수정
- Loading branch information
1 parent
72b9b01
commit 4144a03
Showing
22 changed files
with
665 additions
and
310 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,42 +1,46 @@ | ||
import { fetcher } from '@/app/api/fetcher'; | ||
import { Document, DocumentType } from '@/types'; | ||
import { UpdateDocument } from '@/containers/study/CreateDocumentModal/type'; | ||
|
||
const documentFetcher = fetcher(); | ||
|
||
const postDocument = (groupType: number, groupId: number, document: Document, files: FormData) => { | ||
const postDocument = (token: string, groupType: string, groupId: number, request: FormData) => | ||
documentFetcher(`/${groupType}/${groupId}/documents`, { | ||
method: 'POST', | ||
body: { document, files }, | ||
body: request, | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
const getDocumentList = (groupType: number, groupId: number, page: number = 0, size: number = 4) => { | ||
documentFetcher(`/${groupType}/${groupId}/documents?page=${page}&size=${size}`, { | ||
method: 'GET', | ||
}); | ||
}; | ||
const getDocumentList = (category: string, teamId: number, page: number, size: number) => | ||
documentFetcher(`/${category}/${teamId}/documents?page=${page}&size=${size}`); | ||
|
||
const getDocument = (documentId: number) => { | ||
const getDocument = (token: string, documentId: number) => | ||
documentFetcher(`/${documentId}`, { | ||
method: 'GET', | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
const putDocument = (documentId: number, title: string, description: string, accessType: DocumentType) => { | ||
const putDocument = ( | ||
token: string, | ||
documentId: number, | ||
request: Pick<UpdateDocument, 'title' | 'description' | 'accessType'>, | ||
) => | ||
documentFetcher(`/${documentId}`, { | ||
method: 'PUT', | ||
body: { | ||
title, | ||
description, | ||
accessType, | ||
body: request, | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
const deleteDocument = (documentId: number) => { | ||
const deleteDocument = (token: string, documentId: number) => | ||
documentFetcher(`/${documentId}`, { | ||
method: 'DELETE', | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
}; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use client'; | ||
|
||
import { Button, Flex, Text } from '@chakra-ui/react'; | ||
import { useState } from 'react'; | ||
|
||
import Documents from '@/containers/document/Documents'; | ||
import CreateDocumentModal from '@/containers/study/CreateDocumentModal'; | ||
import { CreateDocument } from '@/containers/study/CreateDocumentModal/type'; | ||
|
||
const Page = ({ params }: { params: { teamId: number } }) => { | ||
const [openCreateModal, setOpenCreateModal] = useState(false); | ||
const categoryData: CreateDocument = { groupId: params.teamId, groupType: 'teams' }; | ||
return ( | ||
<Flex align="center" direction="column" gap="9" w="100%" p="8"> | ||
<Flex justify="space-between" w="100%"> | ||
<Flex direction="row" gap="2"> | ||
<Text textStyle="bold_2xl">학습자료 갤러리</Text> | ||
</Flex> | ||
<Button color="white" bg="orange_dark" onClick={() => setOpenCreateModal(true)} rounded="full"> | ||
자료 등록 | ||
</Button> | ||
</Flex> | ||
<Documents groupId={params.teamId} category="teams" /> | ||
<CreateDocumentModal | ||
isOpen={openCreateModal} | ||
onClose={() => setOpenCreateModal(false)} | ||
categoryData={categoryData} | ||
// groupId={params.teamId} | ||
// groupType="teams" | ||
category="create" | ||
/> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default Page; |
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
Oops, something went wrong.