Skip to content

Commit

Permalink
첫페이지 두번 호출하는 이슈 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
zestlee1106 committed Dec 20, 2023
1 parent 13d80a9 commit 0a885e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function Home() {
// TODO : ModalLayer 로 로그인한 사용자의 Context 생성 필요
// eslint-disable-next-line consistent-return
const selectRooms = async () => {
console.log('%c 🤩🤩🤩 영우의 로그 그럼 왜: ', 'font-size: x-large; color: #bada55;', '');
try {
const data = await getRooms({
...searchParams,
Expand Down Expand Up @@ -120,6 +121,9 @@ function Home() {

useEffect(() => {
const fetchData = async () => {
if (page === 0) {
return;
}
const data = await getRooms({ ...searchParams, page });
setRooms((prevRooms) => [...prevRooms, ...(data?.content || [])]);
setTotalElements(data?.totalElements || 0);
Expand All @@ -131,6 +135,7 @@ function Home() {
// 최초 접근 시 Room 정보 조회
useEffect(() => {
(async () => {
console.log('%c 🤩🤩🤩 영우의 로그 이게 두번?: ', 'font-size: x-large; color: #bada55;', '');
const resultRooms = await selectRooms();
const resultLikedRooms = (await getLikedRooms(page))?.content;
const roomIds = [];
Expand Down

0 comments on commit 0a885e2

Please sign in to comment.