diff --git a/src/api/detail.ts b/src/api/detail.ts
index c17599a0..d2b112d0 100644
--- a/src/api/detail.ts
+++ b/src/api/detail.ts
@@ -25,8 +25,8 @@ export const getIsWish = async (id: number) => {
const response = await axios.get(`/api/wishes/${id}`, {
withCredentials: true,
});
- const data: boolean = response.data;
- return data;
+ const data = response.data;
+ return data.data;
} catch (error) {
if (axios.isAxiosError(error)) {
console.log(error);
diff --git a/src/api/search.ts b/src/api/search.ts
index eea17384..506644c9 100644
--- a/src/api/search.ts
+++ b/src/api/search.ts
@@ -3,68 +3,77 @@ import {Dispatch} from 'react';
import {translateCategoryCode, translateLocation, translateSort} from '@/utils/translateSearchData';
-import {DataType, Keywords, Popular, Search, SearchHotItemType, SearchItemType, SearchKeywordType} from '@/types/home';
+import {DataType, Keywords, Popular, Search, SearchHotItemType, SearchKeywordType} from '@/types/home';
-export async function search(
- keyword: string,
- location: string,
- sort: string,
- set: Dispatch>,
-) {
+interface PramsType {
+ keyword?: string;
+ page: number;
+ size: number;
+ sort: string;
+ categoryCode?: string;
+ areaCode?: number;
+ sigunguCode?: number;
+}
+
+export async function search(keyword: string, location: string, sort: string, page: number) {
try {
const searchLocation = translateLocation(location);
+ const params: PramsType = {
+ keyword: keyword,
+ page: page,
+ size: 20,
+ sort: translateSort(sort),
+ };
+ if (searchLocation.areaCode !== 0) {
+ params.areaCode = searchLocation.areaCode;
+ if (searchLocation.sigunguCode !== 0) {
+ params.sigunguCode = searchLocation.sigunguCode;
+ }
+ }
const fetchData = await axios.get('/api/places/search', {
- params: {
- page: 0,
- size: 20,
- areaCode: searchLocation.areaCode,
- sigunguCode: searchLocation.sigunguCode,
- keyword: keyword,
- sort: translateSort(sort),
- },
+ params: params,
});
const data: DataType = fetchData.data;
- console.log(data.data.places);
- set(data?.data.places);
+ return data?.data.places;
} catch (error) {
console.log(error);
}
}
-export async function keywordSearch(
- keyword: string,
- location: string,
- sort: string,
- set: Dispatch>,
-) {
+export async function keywordSearch(keyword: string, location: string, sort: string, page: number, size = 20) {
try {
const searchLocation = translateLocation(location);
const categoryCode = translateCategoryCode(keyword);
+ const params: PramsType = {
+ page: page,
+ size: size,
+ sort: translateSort(sort),
+ categoryCode: categoryCode,
+ };
+ if (searchLocation.areaCode !== 0) {
+ params.areaCode = searchLocation.areaCode;
+ if (searchLocation.sigunguCode !== 0) {
+ params.sigunguCode = searchLocation.sigunguCode;
+ }
+ }
+
const fetchData = await axios.get('/api/places/search', {
- params: {
- page: 0,
- size: 20,
- areaCode: searchLocation.areaCode,
- sigunguCode: searchLocation.sigunguCode,
- sort: translateSort(sort),
- categoryCode: categoryCode,
- },
+ params: params,
});
const data: DataType = fetchData.data;
- set(data?.data.places);
+ return data?.data.places;
} catch (error) {
console.log(error);
}
}
export async function getPopularItem(
- apiURL: string,
type: number,
set: Dispatch>,
) {
try {
- const fetchData = await axios.get(`${apiURL}`, {
+ const fetchData = await axios.get('/api/places/popular', {
params: {
size: 10,
placeTypeId: type,
diff --git a/src/components/Detail/Navigation/MeatballBottomSlide/MeatballBottomSlide.tsx b/src/components/Detail/Navigation/MeatballBottomSlide/MeatballBottomSlide.tsx
index 97ab009b..bf78cb9d 100644
--- a/src/components/Detail/Navigation/MeatballBottomSlide/MeatballBottomSlide.tsx
+++ b/src/components/Detail/Navigation/MeatballBottomSlide/MeatballBottomSlide.tsx
@@ -2,10 +2,13 @@ import {BiTask} from 'react-icons/bi';
import {CiEdit} from 'react-icons/ci';
import {FaRegHeart} from 'react-icons/fa';
import {IoShareSocialOutline} from 'react-icons/io5';
+import {useLocation} from 'react-router-dom';
import {useRecoilState, useSetRecoilState} from 'recoil';
import styles from './MeatballBottomSlide.module.scss';
+import {useDeleteWishes, usePostWishes} from '@/hooks/Detail/useWish';
+
import CustomToast from '@/components/CustomToast/CustomToast';
import CloseIcon from '@/assets/close.svg?react';
@@ -16,8 +19,6 @@ import RegistrationSlide from '../../BottomFixedBtn/RegistrationSlide/Registrati
import ReviewBottomSlide from '../../Contents/ReviewBottomSlide/ReviewBottomSlide';
import {NavigationMeatballProps} from '@/types/detail';
-import {useDeleteWishes, usePostWishes} from '@/hooks/Detail/useWish';
-import {useLocation} from 'react-router-dom';
const MeatballBottomSlide = ({onBottomSlideOpen, onClose, id, contentTypeId, title}: NavigationMeatballProps) => {
const [isWish, setIsWish] = useRecoilState(IsHeartValued);
@@ -41,8 +42,8 @@ const MeatballBottomSlide = ({onBottomSlideOpen, onClose, id, contentTypeId, tit
};
const showToast = CustomToast();
- const postWishes = usePostWishes();
- const deleteWishes = useDeleteWishes();
+ const postWishes = usePostWishes(id);
+ const deleteWishes = useDeleteWishes(id);
const handleHeartClick = () => {
if (isLogin) {
diff --git a/src/components/Home/RecommendedItemList/RecommendedItemList.tsx b/src/components/Home/RecommendedItemList/RecommendedItemList.tsx
index 8b5fdc79..2dff7753 100644
--- a/src/components/Home/RecommendedItemList/RecommendedItemList.tsx
+++ b/src/components/Home/RecommendedItemList/RecommendedItemList.tsx
@@ -125,16 +125,6 @@ function RecommendedItemList({apiNum}: PropsType) {
},
],
[
- {
- id: 3065360,
- contentTypeId: 28,
- title: '부산 요트투어 요트야',
- thumbnail: 'https://d2ur7st6jjikze.cloudfront.net/offer_photos/119386/832573_large_1686709791.jpg?1686709791',
- areaCode: 6,
- sigunguCode: 16,
- category: '관광',
- rating: '5.0',
- },
{
id: 2774550,
contentTypeId: 28,
@@ -229,6 +219,16 @@ function RecommendedItemList({apiNum}: PropsType) {
category: '관광',
rating: '4.5',
},
+ {
+ id: 3065360,
+ contentTypeId: 28,
+ title: '부산 요트투어 요트야',
+ thumbnail: 'https://d2ur7st6jjikze.cloudfront.net/offer_photos/119386/832573_large_1686709791.jpg?1686709791',
+ areaCode: 6,
+ sigunguCode: 16,
+ category: '관광',
+ rating: '5.0',
+ },
],
];
diff --git a/src/components/Home/VoteAtHome/VoteCard/CardHaveVote/CardHaveVote.tsx b/src/components/Home/VoteAtHome/VoteCard/CardHaveVote/CardHaveVote.tsx
index 3aad2b76..164b180d 100644
--- a/src/components/Home/VoteAtHome/VoteCard/CardHaveVote/CardHaveVote.tsx
+++ b/src/components/Home/VoteAtHome/VoteCard/CardHaveVote/CardHaveVote.tsx
@@ -61,7 +61,7 @@ function CardHaveVote({data}: PropsType) {
{data.title}
-
+
-