Skip to content

Commit e1c0a3c

Browse files
authored
Merge pull request #47 from SWMTheFirstTake/dev
md 사이즈에서 버그 수정
2 parents 7639ec8 + c41a029 commit e1c0a3c

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

app/chat/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export default function Chat() {
1212
const panel = useAtomValue(panelAtom);
1313
const setPanel = useSetAtom(panelAtom);
1414

15-
// md 이상일 때 panel이 'chat'이면 자동으로 'closet'으로 전환
15+
// lg 이상일 때 panel이 'chat'이면 자동으로 'closet'으로 전환
1616
useEffect(() => {
17-
const mq = window.matchMedia('(min-width: 768px)');
17+
const mq = window.matchMedia('(min-width: 1024px)');
1818
const enforceDesktopPanel = (matches: boolean) => {
1919
if (matches && panel === 'chat') {
2020
setPanel('closet');

src/components/landing/NextChat.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default function NextChat() {
2929
if (response.status === 'success' && response.data) {
3030
router.push(`/chat`);
3131
setRoomId(response.data.id);
32+
console.log(response.data.id);
3233
mutate({ roomId: response.data.id, inputValue });
3334
} else console.error('Failed to create chat room:', response.message);
3435
} catch (error) {

src/components/landing/RoomList.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
'use client';
2+
13
import { getChatRoomsHistory } from '@/api/chatAPI';
24
import Link from 'next/link';
5+
import { useEffect, useState } from 'react';
36

4-
export default async function RoomList() {
5-
const response = await getChatRoomsHistory();
7+
export default function RoomList() {
8+
const [roomList, setRoomList] = useState<any[]>([]);
9+
useEffect(() => {
10+
(async () => {
11+
const response = await getChatRoomsHistory();
12+
console.log(response);
13+
if (response?.data?.all_rooms) setRoomList(response?.data.all_rooms);
14+
})();
15+
}, []);
616

7-
console.log(response);
8-
if (response.status == 'fail') {
17+
if (roomList.length == 0) {
918
return <div>채팅을 불러올 수 없습니다.</div>;
1019
}
1120

12-
const roomList = response.data.all_rooms;
1321
return (
1422
<div className="flex flex-col">
1523
{roomList.map((room, i) => (

0 commit comments

Comments
 (0)