@@ -78,7 +144,7 @@ const BlogListNew = () => {
)}
diff --git a/src/pages/api/blog.ts b/src/pages/api/blog.ts
index 3cd1204c..492014aa 100644
--- a/src/pages/api/blog.ts
+++ b/src/pages/api/blog.ts
@@ -14,12 +14,13 @@ export default async function handler(
'public, s-maxage=60, stale-while-revalidate=30'
);
- const { page, per_page, categories } = req.query;
+ const { page, per_page, categories, search } = req.query;
const responseData = await getBlogList({
page: Number(page) || 1,
per_page: Number(per_page) || 9,
categories: categories ? Number(categories) : undefined,
+ search: search ? String(search) : undefined,
});
const blogItemsWithViews = await Promise.all(
diff --git a/src/services/blog.ts b/src/services/blog.ts
index a1f351af..2640b6f5 100644
--- a/src/services/blog.ts
+++ b/src/services/blog.ts
@@ -7,6 +7,7 @@ type BlogParamsProps = {
page?: number;
per_page?: number;
categories?: number | undefined;
+ search?: string;
};
interface BlogDetailResponseProps {
@@ -51,9 +52,10 @@ export const getBlogList = async ({
page = 1,
per_page = 6,
categories,
+ search,
}: BlogParamsProps): Promise<{ status: number; data: any }> => {
try {
- const params = { page, per_page, categories };
+ const params = { page, per_page, categories, search };
const response = await axios.get(`${BLOG_URL}posts`, { params });
return { status: response?.status, data: extractData(response) };
} catch (error) {