feat: 검색 기능 구현
All checks were successful
Deploy blog-frontend / build-and-deploy (push) Successful in 1m52s

This commit is contained in:
ParkWonYeop
2025-12-27 22:17:44 +09:00
parent bf8c548b6a
commit cfecb3d834
5 changed files with 327 additions and 140 deletions

View File

@@ -8,7 +8,7 @@ export const getPosts = async (params?: {
keyword?: string;
category?: string;
tag?: string;
sort?: string; // 🆕 정렬 옵션 추가 (예: 'viewCount,desc')
sort?: string;
}) => {
const response = await http.get<ApiResponse<PostListResponse>>('/api/posts', {
params: {
@@ -20,12 +20,13 @@ export const getPosts = async (params?: {
return response.data.data;
};
// 2. 카테고리별 게시글 조회
export const getPostsByCategory = async (categoryName: string, page = 0, size = 10) => {
// 2. 카테고리별 게시글 조회 (🛠️ keyword 파라미터 추가)
export const getPostsByCategory = async (categoryName: string, page = 0, size = 10, keyword?: string) => {
return getPosts({
page,
size,
category: categoryName
category: categoryName,
keyword // 🆕 검색어 전달
});
};