-
Notifications
You must be signed in to change notification settings - Fork 3
[feature] 관리자페이지 수정하기 api 연동 #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seongwon030
merged 33 commits into
develop/fe
from
feature/#194-clubdetail-edit-api-FE-24
Mar 19, 2025
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a609192
feat: ul padding-left추가
seongwon030 153b686
feat: 모집정보수정 div 세로 정렬 추가
seongwon030 b41d806
feat: 상세페이지 api 가져오기 기능 추가
seongwon030 5da3cbe
feat: clubname 적용하기
seongwon030 670c8d5
feat: 동아리정보및태그 탭 api 연결
seongwon030 1cc1666
feat: 소개정보수정 탭 api 연결
seongwon030 d3b160f
feat: 소개글과 프리뷰 컴포넌트 가로 정렬
seongwon030 2a14c94
feat: 소개글 min-heigth 추가
seongwon030 fbbec74
feat: Editor에 flex-grow추가
seongwon030 bf0874c
refactor: clubDetail 필드명 변경
seongwon030 bb54ff6
fix: 테스트를 위한 클럽id 수정
seongwon030 7b149e5
feat: 수정하기 버튼을 감싸는 wrapper 추가
seongwon030 a5ada22
feat: 동아리 상세정보 수정 api 추가
seongwon030 77a51a1
feat: 동아리 상세정보 수정 api 리액트쿼리 적용
seongwon030 f8c78a2
refactor: ButtonProps를 export 추가
seongwon030 70f8fc5
feat: 애니메이션 버튼 컴포넌트 추가
seongwon030 5b6e7a5
refactor: clubDetail 프로퍼티명 수정
seongwon030 e04ced3
feat: 동아리정보및태그 탭 api연결 및 수정버튼 추가
seongwon030 400c792
feat: 소개정보수정 탭 api연결 및 수정버튼 추가
seongwon030 8812ea4
feat: 소개글 수정 타입 추가
seongwon030 2677367
refactore: queryKey변경
seongwon030 dfa3a67
feat: 소개글 수정 api추가
seongwon030 c66f60e
feat: 소개글 수정 api에 리액트쿼리 적용
seongwon030 f369bf8
fix: clubId 변경
seongwon030 13fe348
feat: FIXME 주석추가
seongwon030 6170629
feat: useQuery에 타입 지정
seongwon030 43bd993
feat: 소개글 수정 탭 api 연결
seongwon030 2ba36c9
refactor: queryKey를 동일하게 유지
seongwon030 32cffe0
refactor: fulfilled 조건 하나로 통일
seongwon030 4f871f2
refactor: suspense제거 및 loading추가
seongwon030 b34b462
refactor: 애니메이션 버튼 prop으로 관리
seongwon030 17bbab8
Merge branch 'develop/fe' into feature/#194-clubdetail-edit-api-FE-24
seongwon030 145d1ed
refactor: 검사 로직 변경
seongwon030 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| import API_BASE_URL from '@/constants/api'; | ||
| import { ClubDescription } from '@/types/club'; | ||
|
|
||
| export const updateClubDescription = async ( | ||
| updatedData: ClubDescription, | ||
| ): Promise<void> => { | ||
| const response = await fetch(`${API_BASE_URL}/api/club/description`, { | ||
| method: 'PUT', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(updatedData), | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| let errorMessage = `Failed to update club (HTTP ${response.status})`; | ||
|
|
||
| try { | ||
| const errorResult = await response.json(); | ||
| if (errorResult?.message) { | ||
| errorMessage += `: ${errorResult.message}`; | ||
| } | ||
| } catch (error) { | ||
| console.error('📌 오류 응답 JSON 파싱 실패:', error); | ||
| } | ||
|
|
||
| throw new Error(errorMessage); | ||
| } | ||
|
|
||
| try { | ||
| await response.json(); | ||
| } catch (error) { | ||
| console.error('📌 JSON 파싱 실패:', error); | ||
| throw new Error('Invalid JSON response from API'); | ||
| } | ||
| }; |
This file contains hidden or 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,35 @@ | ||
| import API_BASE_URL from '@/constants/api'; | ||
| import { ClubDetail } from '@/types/club'; | ||
|
|
||
| export const updateClubDetail = async ( | ||
| updatedData: Partial<ClubDetail>, | ||
| ): Promise<void> => { | ||
| const response = await fetch(`${API_BASE_URL}/api/club/info`, { | ||
| method: 'PUT', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(updatedData), | ||
| }); | ||
|
|
||
| let result; | ||
| try { | ||
| result = await response.json(); | ||
| } catch (error) { | ||
| console.error('📌 JSON 파싱 실패:', error); | ||
| result = null; | ||
| } | ||
seongwon030 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (!response.ok) { | ||
| const errorMessage = result?.message | ||
| ? `Failed to update club (HTTP ${response.status}): ${result.message}` | ||
| : `Failed to update club (HTTP ${response.status})`; | ||
|
|
||
| throw new Error(errorMessage); | ||
| } | ||
|
|
||
| if (!result?.data) { | ||
| console.error('📌 API 응답에 data 필드가 없음:', result); | ||
| throw new Error('Unexpected API response: Missing data field'); | ||
| } | ||
| }; | ||
This file contains hidden or 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 hidden or 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
22 changes: 22 additions & 0 deletions
22
frontend/src/hooks/queries/club/useUpdateClubDescription.ts
This file contains hidden or 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,22 @@ | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
| import { updateClubDescription } from '@/apis/updateClubDescription'; | ||
| import { ClubDescription } from '@/types/club'; | ||
|
|
||
| export const useUpdateClubDescription = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: (updatedData: ClubDescription) => | ||
| updateClubDescription(updatedData), | ||
|
|
||
| onSuccess: async () => { | ||
| await queryClient.invalidateQueries({ | ||
| queryKey: ['clubDetail'], | ||
| }); | ||
| }, | ||
|
|
||
| onError: (error) => { | ||
| console.error('Error updating club detail:', error); | ||
| }, | ||
| }); | ||
| }; |
This file contains hidden or 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,22 @@ | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
| import { updateClubDetail } from '@/apis/updateClubDetail'; | ||
| import { ClubDetail } from '@/types/club'; | ||
|
|
||
| export const useUpdateClubDetail = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: (updatedData: Partial<ClubDetail>) => | ||
| updateClubDetail(updatedData), | ||
|
|
||
| onSuccess: async () => { | ||
| await queryClient.invalidateQueries({ | ||
| queryKey: ['clubDetail'], | ||
| }); | ||
| }, | ||
|
|
||
| onError: (error) => { | ||
| console.error('Error updating club detail:', error); | ||
| }, | ||
| }); | ||
| }; |
This file contains hidden or 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 hidden or 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
6 changes: 6 additions & 0 deletions
6
frontend/src/pages/AdminPage/tabs/ClubInfoEditTab/ClubInfoEditTab.styles.ts
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.