From 3b212be33d19d96b228c5495397beea7ed900251 Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Mon, 25 Jul 2022 23:17:25 +0900 Subject: [PATCH 1/9] =?UTF-8?q?style:=20z-index=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/lounge/LoungeDoor.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/lounge/LoungeDoor.tsx b/src/components/lounge/LoungeDoor.tsx index 1f7f64f2..c9668069 100644 --- a/src/components/lounge/LoungeDoor.tsx +++ b/src/components/lounge/LoungeDoor.tsx @@ -37,11 +37,13 @@ const LoungeFloor = styled.div` const Doors = styled.div` display: grid; - row-gap: 100px; + position: relative; grid-template-rows: 1fr; grid-template-columns: repeat(4, 1fr); - place-items: center; + z-index: 3; width: 950px; + row-gap: 100px; + place-items: center; `; const LoungeDoors = styled.div` @@ -92,6 +94,7 @@ const FloorWrap = styled.div` position: absolute; bottom: -20px; flex-direction: column; + z-index: 0; `; const FloorNumContainer = styled.div` From f8487de9d817d9250ca798a1f5315120dd381b1f Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Tue, 26 Jul 2022 00:18:30 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=A0=8C=EB=8D=94=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/lounge/index.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/pages/lounge/index.tsx b/src/pages/lounge/index.tsx index 3975370a..09515020 100644 --- a/src/pages/lounge/index.tsx +++ b/src/pages/lounge/index.tsx @@ -1,6 +1,8 @@ import styled from 'styled-components'; +import Router from 'next/router'; import { useState, useEffect, useRef } from 'react'; import { scrollTo } from 'seamless-scroll-polyfill'; +import { getCookie } from '~lib/Cookie'; import DoorBottom from '~components/icons/DoorBottom.svg'; import NameBoard from '~components/lounge/NameBoard'; @@ -8,13 +10,27 @@ import FloorButton from '~components/lounge/FloorButton'; import LoungeDoor from '~components/lounge/LoungeDoor'; import NavBar from '~components/NavBar'; +import { useAppDispatch } from '~/store'; +import { showNotice } from '~store/modules/notice'; +import Notice from '~components/Notice/Notice'; + const LoungeHome = () => { const [currentFloor, setCurrentFloor] = useState(0); const floorRef = useRef(null); + const dispatch = useAppDispatch(); // 0: 9-10F / 1: 7-8F / 2: 5-6F / 3: 3-4F / 4: 1-2F const totalFloor = 4; - // + const returnMessage = () => { + dispatch(showNotice('로그인 혹은 회원가입을 진행해주세요!')); + }; + + // 로그인 하지 않은 상태로 라운지 진입시 + useEffect(() => { + if (!getCookie('jwt')) Router.push('/sign-in'); + returnMessage(); + }, []); + const handleScrollUp = () => { if (currentFloor === 0) { setCurrentFloor(totalFloor); @@ -49,6 +65,7 @@ const LoungeHome = () => { + From 2610a662a1bbaae62d3f01e2a678e81f7cb65093 Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Tue, 26 Jul 2022 02:39:53 +0900 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=ED=94=BC=EB=93=9C=EB=B0=B1=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/lounge/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/lounge/index.tsx b/src/pages/lounge/index.tsx index 09515020..51572309 100644 --- a/src/pages/lounge/index.tsx +++ b/src/pages/lounge/index.tsx @@ -27,8 +27,10 @@ const LoungeHome = () => { // 로그인 하지 않은 상태로 라운지 진입시 useEffect(() => { - if (!getCookie('jwt')) Router.push('/sign-in'); - returnMessage(); + if (!getCookie('jwt')) { + Router.push('/sign-in'); + returnMessage(); + } }, []); const handleScrollUp = () => { From 1c7a20e14f7ee22e721128387e8e29e9ffd9a8fe Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Thu, 11 Aug 2022 18:56:38 +0900 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=EB=9D=BC=EC=9A=B4=EC=A7=80=20?= =?UTF-8?q?=EC=86=8C=EC=86=8D=EC=9D=B4=20=EC=95=84=EB=8B=90=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=EC=9D=98=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0=20..=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/lounge/index.tsx | 39 +++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/pages/lounge/index.tsx b/src/pages/lounge/index.tsx index 51572309..4b65963f 100644 --- a/src/pages/lounge/index.tsx +++ b/src/pages/lounge/index.tsx @@ -1,7 +1,8 @@ import styled from 'styled-components'; -import Router from 'next/router'; +import useRouter from 'next/router'; import { useState, useEffect, useRef } from 'react'; import { scrollTo } from 'seamless-scroll-polyfill'; +import Axios from 'axios'; import { getCookie } from '~lib/Cookie'; import DoorBottom from '~components/icons/DoorBottom.svg'; @@ -25,14 +26,46 @@ const LoungeHome = () => { dispatch(showNotice('로그인 혹은 회원가입을 진행해주세요!')); }; + const returnLoungeSelect = async () => { + dispatch(showNotice('라운지 생성을 먼저 진행해주세요!')); + }; + // 로그인 하지 않은 상태로 라운지 진입시 useEffect(() => { - if (!getCookie('jwt')) { - Router.push('/sign-in'); + if (getCookie('jwt')) { + useRouter.push('/sign-in'); returnMessage(); } + statusVerify(); }, []); + // 로그인 O 상태, 라운지 소속일 때 /라운지 소속이 아닐 때 + const statusVerify = async () => { + try { + // 내가 소속된 라운지 리스트 + const loungeList = await Axios.get(`https://api.liontown.city/api/lounges`, { + withCredentials: true, + }); + // 선택한 라운지 정보 -> {id} 부분에 임시로 값 넣음 + const selectLounge = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { + withCredentials: true, + }); + // console.log(selectLounge.data.data.roomData); + // 내가 소속된 라운지 리스트명과 선택한 라운지가 같지 않을 때 + // 혹은 해당 라운지가 없는 경우 라운지 생성페이지로 보내기 + if ( + loungeList.data.data[0].name !== selectLounge.data.data.loungeName.name || + selectLounge.status === 404 + ) { + useRouter.push('/lounge-select'); + setTimeout(() => returnLoungeSelect(), 2000); + } + } catch (err) { + // console.log 없앨 예정 .. + console.log('error'); + } + }; + const handleScrollUp = () => { if (currentFloor === 0) { setCurrentFloor(totalFloor); From 1e544d3281a7c928d5242a8bfbe0fbb3726e5ed0 Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Fri, 12 Aug 2022 19:08:48 +0900 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81-useRouter()=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=EB=84=A3=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/lounge/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/lounge/index.tsx b/src/pages/lounge/index.tsx index 4b65963f..47f61d03 100644 --- a/src/pages/lounge/index.tsx +++ b/src/pages/lounge/index.tsx @@ -1,5 +1,5 @@ import styled from 'styled-components'; -import useRouter from 'next/router'; +import { useRouter } from 'next/router'; import { useState, useEffect, useRef } from 'react'; import { scrollTo } from 'seamless-scroll-polyfill'; import Axios from 'axios'; @@ -16,6 +16,7 @@ import { showNotice } from '~store/modules/notice'; import Notice from '~components/Notice/Notice'; const LoungeHome = () => { + const router = useRouter(); const [currentFloor, setCurrentFloor] = useState(0); const floorRef = useRef(null); const dispatch = useAppDispatch(); @@ -33,7 +34,7 @@ const LoungeHome = () => { // 로그인 하지 않은 상태로 라운지 진입시 useEffect(() => { if (getCookie('jwt')) { - useRouter.push('/sign-in'); + router.push('/sign-in'); returnMessage(); } statusVerify(); @@ -57,7 +58,7 @@ const LoungeHome = () => { loungeList.data.data[0].name !== selectLounge.data.data.loungeName.name || selectLounge.status === 404 ) { - useRouter.push('/lounge-select'); + router.push('/lounge-select'); setTimeout(() => returnLoungeSelect(), 2000); } } catch (err) { From 6afe95f40ece1b0e8296b5b9b70b9baa65ffcb4d Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Sat, 13 Aug 2022 02:19:42 +0900 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=EB=9D=BC=EC=9A=B4=EC=A7=80=20room?= =?UTF-8?q?=20=EA=B0=9C=EC=88=98=EB=B3=84=20UI=20=EA=B9=A8=EC=A7=90=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/lounge/LoungeDemoData.ts | 66 ++++++++++++------------- src/components/lounge/LoungeDoor.tsx | 47 ++++++++++++++++-- src/pages/lounge/index.tsx | 36 ++++++++------ 3 files changed, 97 insertions(+), 52 deletions(-) diff --git a/src/components/lounge/LoungeDemoData.ts b/src/components/lounge/LoungeDemoData.ts index 401c6aa3..fc1be058 100644 --- a/src/components/lounge/LoungeDemoData.ts +++ b/src/components/lounge/LoungeDemoData.ts @@ -8,39 +8,39 @@ const TestDoor: TestDoorType[] = [ { userNum: 2, userName: '유라' }, { userNum: 3, userName: '소연' }, { userNum: 4, userName: '수진' }, - { userNum: 5, userName: '예빈' }, - { userNum: 6, userName: '연빈' }, - { userNum: 7, userName: '민철' }, - { userNum: 8, userName: '민정' }, - { userNum: 9, userName: '재민' }, - { userNum: 10, userName: '성연' }, - { userNum: 11, userName: '한조' }, - { userNum: 12, userName: '호랑이' }, - { userNum: 13, userName: '사자' }, - { userNum: 14, userName: '코끼리' }, - { userNum: 15, userName: '토끼' }, - { userNum: 16, userName: '고양이' }, - { userNum: 17, userName: '강아지' }, - { userNum: 18, userName: '거북이' }, - { userNum: 19, userName: '다람쥐다람쥐다람쥐' }, - { userNum: 20, userName: '앵무새' }, - { userNum: 21, userName: 'ㅇㅇ' }, - { userNum: 22, userName: 'ㅎㅎ' }, - { userNum: 23, userName: 'ㄱㄱ' }, - { userNum: 24, userName: 'ㅁㅁ' }, - { userNum: 25, userName: 'ㄴㄴ' }, - { userNum: 26, userName: 'ㄷㄷ' }, - { userNum: 27, userName: 'ㅂㅂ' }, - { userNum: 28, userName: 'ㅠㅠ' }, - { userNum: 29, userName: 'ㅊㅊ' }, - { userNum: 30, userName: 'ㅌㅌ' }, - { userNum: 31, userName: 'ㅋㅋ' }, - { userNum: 32, userName: 'ㅈㅈ' }, - { userNum: 33, userName: 'ㄹㄹ' }, - { userNum: 34, userName: 'ㅕㅕ' }, - { userNum: 35, userName: 'ㅡㅡ' }, - { userNum: 36, userName: 'ㅔㅔ' }, - { userNum: 37, userName: 'ㅍㅍ' }, + // { userNum: 5, userName: '예빈' }, + // { userNum: 6, userName: '연빈' }, + // { userNum: 7, userName: '민철' }, + // { userNum: 8, userName: '민정' }, + // { userNum: 9, userName: '재민' }, + // { userNum: 10, userName: '성연' }, + // { userNum: 11, userName: '한조' }, + // { userNum: 12, userName: '호랑이' }, + // { userNum: 13, userName: '사자' }, + // { userNum: 14, userName: '코끼리' }, + // { userNum: 15, userName: '토끼' }, + // { userNum: 16, userName: '고양이' }, + // { userNum: 17, userName: '강아지' }, + // { userNum: 18, userName: '거북이' }, + // { userNum: 19, userName: '다람쥐다람쥐다람쥐' }, + // { userNum: 20, userName: '앵무새' }, + // { userNum: 21, userName: 'ㅇㅇ' }, + // { userNum: 22, userName: 'ㅎㅎ' }, + // { userNum: 23, userName: 'ㄱㄱ' }, + // { userNum: 24, userName: 'ㅁㅁ' }, + // { userNum: 25, userName: 'ㄴㄴ' }, + // { userNum: 26, userName: 'ㄷㄷ' }, + // { userNum: 27, userName: 'ㅂㅂ' }, + // { userNum: 28, userName: 'ㅠㅠ' }, + // { userNum: 29, userName: 'ㅊㅊ' }, + // { userNum: 30, userName: 'ㅌㅌ' }, + // { userNum: 31, userName: 'ㅋㅋ' }, + // { userNum: 32, userName: 'ㅈㅈ' }, + // { userNum: 33, userName: 'ㄹㄹ' }, + // { userNum: 34, userName: 'ㅕㅕ' }, + // { userNum: 35, userName: 'ㅡㅡ' }, + // { userNum: 36, userName: 'ㅔㅔ' }, + // { userNum: 37, userName: 'ㅍㅍ' }, ]; export default TestDoor; diff --git a/src/components/lounge/LoungeDoor.tsx b/src/components/lounge/LoungeDoor.tsx index c9668069..bdeec3e5 100644 --- a/src/components/lounge/LoungeDoor.tsx +++ b/src/components/lounge/LoungeDoor.tsx @@ -1,18 +1,53 @@ import styled from 'styled-components'; +import { useState, useEffect } from 'react'; +import Axios from 'axios'; import TestDoor from '~components/lounge/LoungeDemoData'; import FloorNumber from '~components/lounge/FloorDemoData'; +type RoomInfo = { + id: string; + name: string; +}; + const LoungeDoor = () => { + const [roomsList, setRoomsList] = useState(); + + const roomsLoading = async () => { + try { + const roomsRes = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { + withCredentials: true, + }); + setRoomsList(roomsRes.data.data.roomData); + } catch (err) { + console.log('test'); + } + }; + + useEffect(() => { + roomsLoading(); + }, []); + return ( - + + {/* {roomsList + .slice(0) + .reverse() + .map(room => ( + + + {room.userName} + + + + ))} */} {TestDoor.slice(0) .reverse() - .map(door => ( - + .map(room => ( + - {door.userName} + {room.userName} @@ -32,7 +67,9 @@ const LoungeDoor = () => { const LoungeFloor = styled.div` position: relative; - bottom: -5px; + + /* 라운지 개인 방이 4개 이하인 경우에 붕 뜸 현상 > margin-top 속성 필요.. */ + margin-top: ${props => (props.roomsLength <= 4 ? '320px' : '0')}; `; const Doors = styled.div` diff --git a/src/pages/lounge/index.tsx b/src/pages/lounge/index.tsx index 47f61d03..e4e27b51 100644 --- a/src/pages/lounge/index.tsx +++ b/src/pages/lounge/index.tsx @@ -1,5 +1,6 @@ import styled from 'styled-components'; import { useRouter } from 'next/router'; +import { useQuery } from '@tanstack/react-query'; import { useState, useEffect, useRef } from 'react'; import { scrollTo } from 'seamless-scroll-polyfill'; import Axios from 'axios'; @@ -18,6 +19,7 @@ import Notice from '~components/Notice/Notice'; const LoungeHome = () => { const router = useRouter(); const [currentFloor, setCurrentFloor] = useState(0); + // const [loungeId, setLoungeId] = useState(''); const floorRef = useRef(null); const dispatch = useAppDispatch(); // 0: 9-10F / 1: 7-8F / 2: 5-6F / 3: 3-4F / 4: 1-2F @@ -27,20 +29,12 @@ const LoungeHome = () => { dispatch(showNotice('로그인 혹은 회원가입을 진행해주세요!')); }; - const returnLoungeSelect = async () => { + const returnLoungeSelect = () => { dispatch(showNotice('라운지 생성을 먼저 진행해주세요!')); + console.log('returnLoungeSelect 실행완료'); }; - // 로그인 하지 않은 상태로 라운지 진입시 - useEffect(() => { - if (getCookie('jwt')) { - router.push('/sign-in'); - returnMessage(); - } - statusVerify(); - }, []); - - // 로그인 O 상태, 라운지 소속일 때 /라운지 소속이 아닐 때 + // 로그인 O 상태, 라운지 소속일 때 / 라운지 소속이 아닐 때 const statusVerify = async () => { try { // 내가 소속된 라운지 리스트 @@ -51,7 +45,7 @@ const LoungeHome = () => { const selectLounge = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { withCredentials: true, }); - // console.log(selectLounge.data.data.roomData); + // 내가 소속된 라운지 리스트명과 선택한 라운지가 같지 않을 때 // 혹은 해당 라운지가 없는 경우 라운지 생성페이지로 보내기 if ( @@ -59,7 +53,8 @@ const LoungeHome = () => { selectLounge.status === 404 ) { router.push('/lounge-select'); - setTimeout(() => returnLoungeSelect(), 2000); + returnLoungeSelect(); + // setTimeout(() => returnLoungeSelect(), 2000); } } catch (err) { // console.log 없앨 예정 .. @@ -67,6 +62,16 @@ const LoungeHome = () => { } }; + // 로그인 하지 않은 상태로 라운지 진입시 + useEffect(() => { + if (getCookie('jwt')) { + router.push('/sign-in'); + returnMessage(); + } else { + statusVerify(); + } + }, []); + const handleScrollUp = () => { if (currentFloor === 0) { setCurrentFloor(totalFloor); @@ -136,8 +141,11 @@ const ListBottomContainer = styled.div` const LoungeFloor = styled.div` margin-bottom: 0; + margin-bottom: -20px; width: 975px; - height: 535px; + + /* height: 535px; */ + height: 555px; overflow: hidden; `; From 95decef1af28d07e3e735e5fd5947e8005dcff7c Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Sat, 13 Aug 2022 02:31:50 +0900 Subject: [PATCH 7/9] =?UTF-8?q?feat:=20api=EC=97=90=20=EB=8B=B4=EA=B8=B4?= =?UTF-8?q?=20=EB=9D=BC=EC=9A=B4=EC=A7=80=EB=B3=84=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/lounge/NameBoard.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/lounge/NameBoard.tsx b/src/components/lounge/NameBoard.tsx index ed587eba..de8b1bfb 100644 --- a/src/components/lounge/NameBoard.tsx +++ b/src/components/lounge/NameBoard.tsx @@ -1,6 +1,25 @@ import styled from 'styled-components'; +import { useState, useEffect } from 'react'; +import Axios from 'axios'; const NameBoard = () => { + const [loungeName, setLoungeName] = useState(''); + + const settingLoungeName = async () => { + try { + const res = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { + withCredentials: true, + }); + setLoungeName(res.data.data.loungeName.name); + } catch (err) { + console.log('error'); + } + }; + + useEffect(() => { + settingLoungeName(); + }, []); + return ( @@ -8,7 +27,7 @@ const NameBoard = () => { - 멋쟁이사자처럼 명지대 + {loungeName} ); From 0bfeaaf8b6e267148013056ed74e8963be88bc31 Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Sat, 13 Aug 2022 13:18:42 +0900 Subject: [PATCH 8/9] =?UTF-8?q?feat:=20=EB=82=B4=EA=B0=80=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=ED=95=9C=20=EB=9D=BC=EC=9A=B4=EC=A7=80=EC=9D=98=20?= =?UTF-8?q?=EB=B0=A9=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/lounge/LoungeDoor.tsx | 30 ++++++++---------------- src/pages/lounge/{index.tsx => [id].tsx} | 17 ++++---------- 2 files changed, 14 insertions(+), 33 deletions(-) rename src/pages/lounge/{index.tsx => [id].tsx} (87%) diff --git a/src/components/lounge/LoungeDoor.tsx b/src/components/lounge/LoungeDoor.tsx index bdeec3e5..913922a5 100644 --- a/src/components/lounge/LoungeDoor.tsx +++ b/src/components/lounge/LoungeDoor.tsx @@ -2,23 +2,23 @@ import styled from 'styled-components'; import { useState, useEffect } from 'react'; import Axios from 'axios'; -import TestDoor from '~components/lounge/LoungeDemoData'; import FloorNumber from '~components/lounge/FloorDemoData'; type RoomInfo = { - id: string; - name: string; + userId: string; + userName: string; }; const LoungeDoor = () => { - const [roomsList, setRoomsList] = useState(); + const [roomsList, setRoomsList] = useState([]); const roomsLoading = async () => { try { - const roomsRes = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { + const roomRes = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { withCredentials: true, }); - setRoomsList(roomsRes.data.data.roomData); + setRoomsList(roomRes.data.data.roomData); + return roomsList; } catch (err) { console.log('test'); } @@ -29,23 +29,13 @@ const LoungeDoor = () => { }, []); return ( - + - {/* {roomsList + {roomsList .slice(0) .reverse() .map(room => ( - - - {room.userName} - - - - ))} */} - {TestDoor.slice(0) - .reverse() - .map(room => ( - + {room.userName} @@ -68,7 +58,7 @@ const LoungeDoor = () => { const LoungeFloor = styled.div` position: relative; - /* 라운지 개인 방이 4개 이하인 경우에 붕 뜸 현상 > margin-top 속성 필요.. */ + /* 라운지 개인 방이 4개 이하인 경우에 붕 뜸 현상 > margin-top 속성 필요.. */ margin-top: ${props => (props.roomsLength <= 4 ? '320px' : '0')}; `; diff --git a/src/pages/lounge/index.tsx b/src/pages/lounge/[id].tsx similarity index 87% rename from src/pages/lounge/index.tsx rename to src/pages/lounge/[id].tsx index e4e27b51..55501e08 100644 --- a/src/pages/lounge/index.tsx +++ b/src/pages/lounge/[id].tsx @@ -19,7 +19,6 @@ import Notice from '~components/Notice/Notice'; const LoungeHome = () => { const router = useRouter(); const [currentFloor, setCurrentFloor] = useState(0); - // const [loungeId, setLoungeId] = useState(''); const floorRef = useRef(null); const dispatch = useAppDispatch(); // 0: 9-10F / 1: 7-8F / 2: 5-6F / 3: 3-4F / 4: 1-2F @@ -37,24 +36,16 @@ const LoungeHome = () => { // 로그인 O 상태, 라운지 소속일 때 / 라운지 소속이 아닐 때 const statusVerify = async () => { try { - // 내가 소속된 라운지 리스트 - const loungeList = await Axios.get(`https://api.liontown.city/api/lounges`, { - withCredentials: true, - }); - // 선택한 라운지 정보 -> {id} 부분에 임시로 값 넣음 + // 선택한 라운지 정보 -> {id} 부분에 임시로 값 넣음 : sgIG8L로 테스트 가능 const selectLounge = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { withCredentials: true, }); - // 내가 소속된 라운지 리스트명과 선택한 라운지가 같지 않을 때 - // 혹은 해당 라운지가 없는 경우 라운지 생성페이지로 보내기 - if ( - loungeList.data.data[0].name !== selectLounge.data.data.loungeName.name || - selectLounge.status === 404 - ) { + // 해당 라운지가 없는 경우 라운지 생성페이지로 보내기 + if (selectLounge.status === 404) { router.push('/lounge-select'); returnLoungeSelect(); - // setTimeout(() => returnLoungeSelect(), 2000); + setTimeout(() => returnLoungeSelect(), 2000); } } catch (err) { // console.log 없앨 예정 .. From 58f244ef06138f72851b33df447e0463c90e4f89 Mon Sep 17 00:00:00 2001 From: JJongsKim Date: Sat, 13 Aug 2022 14:52:23 +0900 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20base=20URL=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=ED=95=9C=20import=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/lounge/LoungeDoor.tsx | 4 ++-- src/pages/lounge/[id].tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/lounge/LoungeDoor.tsx b/src/components/lounge/LoungeDoor.tsx index 913922a5..a27cd958 100644 --- a/src/components/lounge/LoungeDoor.tsx +++ b/src/components/lounge/LoungeDoor.tsx @@ -1,6 +1,6 @@ import styled from 'styled-components'; import { useState, useEffect } from 'react'; -import Axios from 'axios'; +import Axios from '~lib/axios'; import FloorNumber from '~components/lounge/FloorDemoData'; @@ -14,7 +14,7 @@ const LoungeDoor = () => { const roomsLoading = async () => { try { - const roomRes = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { + const roomRes = await Axios.get(`/api/lounges/sgIG8L`, { withCredentials: true, }); setRoomsList(roomRes.data.data.roomData); diff --git a/src/pages/lounge/[id].tsx b/src/pages/lounge/[id].tsx index 55501e08..a79348b7 100644 --- a/src/pages/lounge/[id].tsx +++ b/src/pages/lounge/[id].tsx @@ -3,7 +3,7 @@ import { useRouter } from 'next/router'; import { useQuery } from '@tanstack/react-query'; import { useState, useEffect, useRef } from 'react'; import { scrollTo } from 'seamless-scroll-polyfill'; -import Axios from 'axios'; +import Axios from '~lib/axios'; import { getCookie } from '~lib/Cookie'; import DoorBottom from '~components/icons/DoorBottom.svg'; @@ -37,7 +37,7 @@ const LoungeHome = () => { const statusVerify = async () => { try { // 선택한 라운지 정보 -> {id} 부분에 임시로 값 넣음 : sgIG8L로 테스트 가능 - const selectLounge = await Axios.get(`https://api.liontown.city/api/lounges/sgIG8L`, { + const selectLounge = await Axios.get(`/api/lounges/sgIG8L`, { withCredentials: true, });