Skip to content

Commit 32f6884

Browse files
committed
Fix: chatting 도메인 api 응답 수정
1 parent 6208de2 commit 32f6884

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/apis/chatting/dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// base response 형태를 따르지 않으므로 data 접미사를 사용했습니다.
33
// response
44
export interface ChatRoomData {
5-
chatRoomId: number;
5+
id: number;
66
otherUser: OtherUserDto;
77
latestMessage: LatestMessageDto;
88
}
99

1010
export interface OtherUserDto {
1111
id: number;
1212
nickname: string;
13-
profileUrl: string;
13+
profilePictureUrl: string;
1414
}
1515

1616
export interface LatestMessageDto {

src/pages/Chats/ChatRoom/createExtendedMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const createExtendedMessages = (
5858
// 받은 메시지일 경우 rcvdMessage 속성 추가
5959
const rcvdMessage: RcvdMessageProps = {
6060
fromUserNickname: opponentInfo?.nickname || '알수없음',
61-
profilePictureUrl: opponentInfo?.profileUrl || defaultProfile,
61+
profilePictureUrl: opponentInfo?.profilePictureUrl || defaultProfile,
6262
content: message.content,
6363
isProfileImageVisible,
6464
isSenderChanged,

src/pages/Chats/ChatRoomItem/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import type { ChatRoomData } from '@apis/chatting/dto';
1111
import defaultProfile from '@assets/default/defaultProfile.svg';
1212
dayjs.extend(relativeTime);
1313

14-
const ChatRoomItem: React.FC<ChatRoomData> = ({ chatRoomId, otherUser, latestMessage }) => {
14+
const ChatRoomItem: React.FC<ChatRoomData> = ({ id, otherUser, latestMessage }) => {
1515
const [timeAgo, setTimeAgo] = useState<string | null>(null);
1616
const [, setOpponentInfo] = useRecoilState(OpponentInfoAtom);
1717
const nav = useNavigate();
1818

1919
const handleChatRoomClick = () => {
2020
setOpponentInfo(otherUser);
21-
nav(`/chats/${chatRoomId}`);
21+
nav(`/chats/${id}`);
2222
};
2323

2424
useEffect(() => {
@@ -40,7 +40,7 @@ const ChatRoomItem: React.FC<ChatRoomData> = ({ chatRoomId, otherUser, latestMes
4040

4141
return (
4242
<ChatRoomItemLayout onClick={handleChatRoomClick}>
43-
<UserImage src={otherUser?.profileUrl || defaultProfile} alt="user" />
43+
<UserImage src={otherUser?.profilePictureUrl || defaultProfile} alt="user" />
4444
<LeftBox>
4545
<StyledText $textTheme={{ style: 'body2-medium' }} color="#1D1D1D">
4646
{otherUser?.nickname || '알수없음'}

src/pages/Chats/Matching/Cards/Card/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Card: React.FC<CardProps> = ({ removeRejectedMatching, matching }) => {
6161
setOpponentInfo({
6262
id: requester.id,
6363
nickname: requester.nickname,
64-
profileUrl: requester.profilePictureUrl,
64+
profilePictureUrl: requester.profilePictureUrl,
6565
});
6666
nav(`/chats/${response.data.chatRoomId}`);
6767
}

src/pages/Chats/RecentChat/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ const RecentChat: React.FC<RecentChatProps> = () => {
5050
최근 채팅방
5151
</RecentChatInfo>
5252
<ChatRoomList>
53-
{chatRoomList.map((room) => (
54-
<ChatRoomItem key={room.chatRoomId} {...room} />
53+
{chatRoomList.map((chatRoom) => (
54+
<ChatRoomItem key={chatRoom.id} {...chatRoom} />
5555
))}
5656
</ChatRoomList>
5757
</>

0 commit comments

Comments
 (0)