diff --git a/src/api/rooms/getRoomDetail.ts b/src/api/rooms/getRoomDetail.ts index c3954430..079a862f 100644 --- a/src/api/rooms/getRoomDetail.ts +++ b/src/api/rooms/getRoomDetail.ts @@ -1,4 +1,5 @@ import { apiClient } from '../index'; +import { AxiosError } from 'axios'; // 방 상세 정보 응답 타입 export interface RoomDetailResponse { @@ -42,8 +43,21 @@ export const getRoomDetail = async (roomId: number): Promise try { const response = await apiClient.get(`/rooms/${roomId}/recruiting`); return response.data; - } catch (error) { + } catch (error: unknown) { console.error('방 상세 정보 조회 API 오류:', error); + + if (error instanceof AxiosError) { + // 모집기간이 만료된 방인 경우 + if (error.response?.data?.code === 100004) { + throw new Error('모집기간이 만료된 방입니다.'); + } + + // 방 접근 권한이 없는 경우 + if (error.response?.data?.code === 140011) { + throw new Error('방 접근 권한이 없습니다.'); + } + } + throw error; } }; diff --git a/src/api/rooms/getRoomMembers.ts b/src/api/rooms/getRoomMembers.ts index 2ba7f589..50f136be 100644 --- a/src/api/rooms/getRoomMembers.ts +++ b/src/api/rooms/getRoomMembers.ts @@ -1,4 +1,5 @@ import { apiClient } from '../index'; +import { AxiosError } from 'axios'; export interface RoomMember { userId: number; @@ -47,8 +48,14 @@ export const getRoomMembers = async (roomId: number): Promise(`/rooms/${roomId}/users`); return response.data; - } catch (error) { + } catch (error: unknown) { console.error('독서메이트 조회 API 오류:', error); + + // 방 접근 권한이 없는 경우 + if (error instanceof AxiosError && error.response?.data?.code === 140011) { + throw new Error('방 접근 권한이 없습니다.'); + } + throw error; } }; diff --git a/src/api/rooms/getRoomPlaying.ts b/src/api/rooms/getRoomPlaying.ts index f19a120a..d21d0c72 100644 --- a/src/api/rooms/getRoomPlaying.ts +++ b/src/api/rooms/getRoomPlaying.ts @@ -1,4 +1,5 @@ import { apiClient } from '../index'; +import { AxiosError } from 'axios'; // 투표 아이템 타입 export interface VoteItem { @@ -65,8 +66,14 @@ export const getRoomPlaying = async (roomId: number): Promise(`/rooms/${roomId}/playing`); return response.data; - } catch (error) { + } catch (error: unknown) { console.error('진행중인 방 상세 정보 조회 API 오류:', error); + + // 방 접근 권한이 없는 경우 + if (error instanceof AxiosError && error.response?.data?.code === 140011) { + throw new Error('방 접근 권한이 없습니다.'); + } + throw error; } }; diff --git a/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx b/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx index 9b24e91d..31d2579b 100644 --- a/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx +++ b/src/components/creategroup/ActivityPeriodSection/ActivityPeriodSection.tsx @@ -87,7 +87,7 @@ const ActivityPeriodSection = ({ const getInitialEndDate = () => { const tomorrow = new Date(); - tomorrow.setDate(tomorrow.getDate() + 1); + tomorrow.setDate(tomorrow.getDate() + 2); return { year: tomorrow.getFullYear(), month: tomorrow.getMonth() + 1, diff --git a/src/components/creategroup/GenreSelectionSection.tsx b/src/components/creategroup/GenreSelectionSection.tsx index c8376685..dbb7d285 100644 --- a/src/components/creategroup/GenreSelectionSection.tsx +++ b/src/components/creategroup/GenreSelectionSection.tsx @@ -12,6 +12,7 @@ const GenreSelectionSection = ({ selectedGenre, onGenreSelect }: GenreSelectionS return (
+
책 장르 {genres.map(genre => ( diff --git a/src/components/creategroup/MemberLimitSection.tsx b/src/components/creategroup/MemberLimitSection.tsx index 6ba5d4bf..74e1b739 100644 --- a/src/components/creategroup/MemberLimitSection.tsx +++ b/src/components/creategroup/MemberLimitSection.tsx @@ -17,6 +17,7 @@ const MemberLimitSection = ({ memberLimit, onMemberLimitChange }: MemberLimitSec return (
+
인원 제한 diff --git a/src/components/creategroup/PrivacySettingSection/PrivacySettingSection.tsx b/src/components/creategroup/PrivacySettingSection/PrivacySettingSection.tsx index 02ae3f9d..7921feb2 100644 --- a/src/components/creategroup/PrivacySettingSection/PrivacySettingSection.tsx +++ b/src/components/creategroup/PrivacySettingSection/PrivacySettingSection.tsx @@ -24,6 +24,7 @@ const PrivacySettingSection = ({ }: PrivacySettingSectionProps) => { return (
+
공개 설정 비공개로 설정하기 diff --git a/src/components/creategroup/RoomInfoSection.tsx b/src/components/creategroup/RoomInfoSection.tsx index e3b5f48c..2629d35d 100644 --- a/src/components/creategroup/RoomInfoSection.tsx +++ b/src/components/creategroup/RoomInfoSection.tsx @@ -16,6 +16,7 @@ const RoomInfoSection = ({ }: RoomInfoSectionProps) => { return ( <> +
방 제목 @@ -45,6 +46,8 @@ const RoomInfoSection = ({ {roomDescription.length} / 75
+ +
); }; diff --git a/src/components/group/CommentSection.styled.ts b/src/components/group/CommentSection.styled.ts index a1e036ed..d1e96aab 100644 --- a/src/components/group/CommentSection.styled.ts +++ b/src/components/group/CommentSection.styled.ts @@ -10,13 +10,18 @@ export const CommentSection = styled.section` margin: 20px 20px 0 20px; padding: 16px 12px; border-radius: 12px; + cursor: pointer; + + &:focus-visible { + outline: 2px solid ${colors.purple.main}; + outline-offset: 2px; + } `; export const CommentSectionHeader = styled.div` display: flex; justify-content: space-between; align-items: center; - cursor: pointer; `; export const CommentSectionTitle = styled.h3` diff --git a/src/components/group/CommentSection.tsx b/src/components/group/CommentSection.tsx index 6b38671c..0ee734e1 100644 --- a/src/components/group/CommentSection.tsx +++ b/src/components/group/CommentSection.tsx @@ -15,8 +15,8 @@ interface CommentSectionProps { const CommentSection = ({ message, onClick }: CommentSectionProps) => { return ( - - + + 오늘의 한마디 diff --git a/src/components/group/RecordSection.styled.ts b/src/components/group/RecordSection.styled.ts index 3ff17e12..f675f5bc 100644 --- a/src/components/group/RecordSection.styled.ts +++ b/src/components/group/RecordSection.styled.ts @@ -10,13 +10,13 @@ export const RecordSection = styled.section` margin: 20px 20px 0 20px; padding: 16px 12px; border-radius: 12px; + cursor: pointer; `; export const RecordSectionHeader = styled.div` display: flex; justify-content: space-between; align-items: center; - cursor: pointer; `; export const RecordSectionTitle = styled.h3` diff --git a/src/components/group/RecordSection.tsx b/src/components/group/RecordSection.tsx index e3d34de7..4542bf02 100644 --- a/src/components/group/RecordSection.tsx +++ b/src/components/group/RecordSection.tsx @@ -20,8 +20,8 @@ interface RecordSectionProps { const RecordSection = ({ currentPage, progress, onClick }: RecordSectionProps) => { return ( - - + + 기록장 diff --git a/src/components/memory/RecordItem/RecordItem.tsx b/src/components/memory/RecordItem/RecordItem.tsx index b41ff663..8d8645a4 100644 --- a/src/components/memory/RecordItem/RecordItem.tsx +++ b/src/components/memory/RecordItem/RecordItem.tsx @@ -269,14 +269,20 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { const handleClick = useCallback(() => { // 클릭으로 더보기 메뉴 표시 if (isMyRecord) { - openMoreMenu({ + const menuOptions: any = { onEdit: handleEdit, onDelete: handleDeleteConfirm, - onPin: handlePinConfirm, onClose: closePopup, type: 'post', isWriter: true, - }); + }; + + // 기록(text)일 때만 핀하기 기능 추가 + if (type === 'text') { + menuOptions.onPin = handlePinConfirm; + } + + openMoreMenu(menuOptions); } else { openMoreMenu({ onReport: handleReport, @@ -285,6 +291,7 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { } }, [ isMyRecord, + type, openMoreMenu, handleReport, handleEdit, @@ -365,7 +372,7 @@ const RecordItem = ({ record, shouldBlur = false }: RecordItemProps) => { 댓글 {commentCount} - {isMyRecord && ( + {isMyRecord && type === 'text' && ( { } else { setError(response.message); } - } catch (error) { + } catch (error: unknown) { console.error('방 상세 정보 조회 실패:', error); + + // 모집기간이 만료된 방인 경우 - 진행중인 방으로 리다이렉트 + if (error instanceof Error && error.message === '모집기간이 만료된 방입니다.') { + navigate(`/group/detail/joined/${roomId}`, { replace: true }); + return; + } + + // 방 접근 권한이 없는 경우 - 모임 홈으로 리다이렉트 + if (error instanceof Error && error.message === '방 접근 권한이 없습니다.') { + navigate('/group', { replace: true }); + return; + } + setError('방 정보를 불러오는데 실패했습니다.'); } finally { setIsLoading(false); diff --git a/src/pages/groupDetail/ParticipatedGroupDetail.tsx b/src/pages/groupDetail/ParticipatedGroupDetail.tsx index b4756947..38f35343 100644 --- a/src/pages/groupDetail/ParticipatedGroupDetail.tsx +++ b/src/pages/groupDetail/ParticipatedGroupDetail.tsx @@ -74,9 +74,16 @@ const ParticipatedGroupDetail = () => { } else { setError(response.message); } - } catch (err) { - setError('방 정보를 불러오는 중 오류가 발생했습니다.'); + } catch (err: unknown) { console.error('방 상세 정보 조회 오류:', err); + + // 방 접근 권한이 없는 경우 - 모임 홈으로 리다이렉트 + if (err instanceof Error && err.message === '방 접근 권한이 없습니다.') { + navigate('/group', { replace: true }); + return; + } + + setError('방 정보를 불러오는 중 오류가 발생했습니다.'); } finally { setLoading(false); } diff --git a/src/pages/groupMembers/GroupMembers.tsx b/src/pages/groupMembers/GroupMembers.tsx index a0886427..c429263a 100644 --- a/src/pages/groupMembers/GroupMembers.tsx +++ b/src/pages/groupMembers/GroupMembers.tsx @@ -42,9 +42,16 @@ const GroupMembers = () => { } else { setError(response.message); } - } catch (err) { - setError('독서메이트 목록을 불러오는 중 오류가 발생했습니다.'); + } catch (err: unknown) { console.error('독서메이트 조회 오류:', err); + + // 방 접근 권한이 없는 경우 - 모임 홈으로 리다이렉트 + if (err instanceof Error && err.message === '방 접근 권한이 없습니다.') { + navigate('/group', { replace: true }); + return; + } + + setError('독서메이트 목록을 불러오는 중 오류가 발생했습니다.'); } finally { setLoading(false); } diff --git a/src/pages/post/UpdatePost.tsx b/src/pages/post/UpdatePost.tsx index 597b4d16..a7bd65e2 100644 --- a/src/pages/post/UpdatePost.tsx +++ b/src/pages/post/UpdatePost.tsx @@ -108,7 +108,7 @@ const UpdatePost = () => { contentBody: postContent.trim(), isPublic: !isPrivate, ...(selectedTags.length ? { tagList: selectedTags } : {}), - ...(remainImageUrls.length ? { remainImageUrls } : {}), + remainImageUrls, // 이미지가 없어도 빈 배열로 전송하여 삭제 처리 }; const result = await updateExistingFeed(Number(feedId), body);