File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed
Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff 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' ) ;
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+
13import { getChatRoomsHistory } from '@/api/chatAPI' ;
24import 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 ) => (
You can’t perform that action at this time.
0 commit comments