Skip to content

Commit

Permalink
[feat] 응답값 바뀐것에 대한 대응...
Browse files Browse the repository at this point in the history
  • Loading branch information
zestlee1106 committed Oct 19, 2023
1 parent 73ff551 commit bb1a716
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ export default function Filter({

useEffect(() => {
const formattedSelectedLocation = selectedLocations.map((item) => item.dong.value);

if (
!selectedLocations.length &&
!minDeposit &&
!maxDeposit &&
!minMonthlyRent &&
!maxMonthlyRent &&
!dateAvailable
) {
return;
}

const fetchData = async () => {
const data = await getRooms({
locationIds: formattedSelectedLocation.join(', '),
Expand Down
2 changes: 1 addition & 1 deletion components/RoomCard/RoomCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function RoomCard({ room, onClick }: CardProps) {
return (
<Card
title={<UserInfo userInfo={room?.user} />}
content={<Photo photos={room.imageFiles} onClick={onClick} />}
content={<Photo photos={room.images} onClick={onClick} />}
footer={<Footer room={room} />}
/>
);
Expand Down
6 changes: 3 additions & 3 deletions pages/room/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,21 @@ export default function RoomDetail() {
{room && (
<>
<div className="font-pretendard w-full mb-[71px]">
{room.imageFiles.length > 0 ? (
{room.images.length > 0 ? (
<Swiper
effect="coverflow"
slidesPerView={1}
loop
className="mySwiper !mx-[-20px] h-[240px] relative"
onSlideChangeTransitionEnd={(event) => handleSlideChange(event.realIndex)}
>
{room.imageFiles.map((image, idx) => (
{room.images.map((image, idx) => (
<SwiperSlide className={styles['swiper-slide']} key={`room-image-${idx}`}>
<img src={image.path} alt={`room-${idx}`} />
</SwiperSlide>
))}
<div className={styles.tag}>
{currentSlide + 1}/{room.imageFiles.length}
{currentSlide + 1}/{room.images.length}
</div>
</Swiper>
) : (
Expand Down
2 changes: 1 addition & 1 deletion public/types/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export interface RoomSearch {
furnishings: FurnishingData[];
availableDate: string;
description: string;
imageFiles: ImageFile[];
images: ImageFile[];
user: User;
furnishingsData?: string[];
}
Expand Down

0 comments on commit bb1a716

Please sign in to comment.