From 7586bbb709831fa4d26e49f3e91aa9dc76e8a78b Mon Sep 17 00:00:00 2001 From: typhoon0678 Date: Thu, 7 Aug 2025 06:20:38 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EC=A1=B0=ED=9A=8C=EC=88=98=20?= =?UTF-8?q?=EC=A6=9D=EA=B0=80,=20=EC=A1=B0=ED=9A=8C=20api=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/apis/post.tsx | 12 ++++- src/common/types/post.tsx | 1 + src/components/post/TagCard.tsx | 4 +- src/pages/blog/BlogTagPage.tsx | 31 ++++++------- src/pages/post/PostPage.tsx | 79 ++++++++++++++++++++------------- 5 files changed, 78 insertions(+), 49 deletions(-) diff --git a/src/common/apis/post.tsx b/src/common/apis/post.tsx index 83bc9c7..445916c 100644 --- a/src/common/apis/post.tsx +++ b/src/common/apis/post.tsx @@ -5,7 +5,7 @@ import { PostListTagRequest, PostRequest, PostSearchRequest, - PostUpdateRequest + PostUpdateRequest, } from "../types/post.tsx"; import { postListRequestToParameter, @@ -35,4 +35,12 @@ export const getMemberTagPosts = async (postListTagRequest: PostListTagRequest) await axiosApi.get(`/post/member/tag${postListTagRequestToParameter(postListTagRequest)}`); export const searchPost = async (postSearchRequest: PostSearchRequest) => - await axiosApi.get(`/post/search${postListSearchRequestToParameter(postSearchRequest)}`); \ No newline at end of file + await axiosApi.get(`/post/search${postListSearchRequestToParameter(postSearchRequest)}`); + +export const incrementPostViewCount = async (id: string) => + await axiosApi.post(`/post/view/increment`, { + postId: id + }); + +export const getPostViewCount = async (id: string) => + await axiosApi.get(`/post/view/${id}`); \ No newline at end of file diff --git a/src/common/types/post.tsx b/src/common/types/post.tsx index 3398dc3..a3674b4 100644 --- a/src/common/types/post.tsx +++ b/src/common/types/post.tsx @@ -52,6 +52,7 @@ export interface PostResponse { username: string; folder?: PostFolderResponse; tags: TagResponse[]; + viewCount: number; createdAt: Date; } diff --git a/src/components/post/TagCard.tsx b/src/components/post/TagCard.tsx index f0c2c60..af46502 100644 --- a/src/components/post/TagCard.tsx +++ b/src/components/post/TagCard.tsx @@ -1,6 +1,6 @@ -import {TagResponse} from "../../common/types/post.tsx"; +import { TagResponse } from "../../common/types/post.tsx"; -function TagCard({tag, onClick}: { tag: TagResponse, onClick: () => void }) { +function TagCard({ tag, onClick }: { tag: TagResponse, onClick: () => void }) { return (