From 8754e9b3bdfc39da953e3cf13df414bdc861dd68 Mon Sep 17 00:00:00 2001 From: Kim Yunji Date: Mon, 1 Dec 2025 00:09:21 +0900 Subject: [PATCH] =?UTF-8?q?Chore:=20=EC=9E=90=EB=8F=99=20=EB=B0=B0?= =?UTF-8?q?=ED=8F=AC=20github=20action=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 34 ++++++++++++++++++++++++++ build.sh | 5 ++++ livin/app/houses/review/[id]/page.tsx | 35 +++++---------------------- 3 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 build.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..50536ab --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy + +on: + push: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + container: pandoc/latex + steps: + - uses: actions/checkout@v2 + + - name: Install mustache (to update the date) + run: apk add ruby && gem install mustache + + - name: creates output + run: sh ./build.sh + + - name: Pushes to another repository + id: push_directory + uses: cpina/github-action-push-to-another-repository@main + env: + API_TOKEN_GITHUB: ${{ secrets.AUTO_ACTIONS }} + with: + source-directory: "output" + destination-github-username: [ynjii] + destination-repository-name: [livin] + user-email: ${{ secrets.EMAIL }} + commit-message: ${{ github.event.commits[0].message }} + target-branch: main + + - name: Test get variable exported by push-to-another-repository + run: echo $DESTINATION_CLONED_DIRECTORY diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..5627271 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh +cd ../ +mkdir output +cp -R ./[Frontend]/* ./output +cp -R ./output ./[Frontend]/ \ No newline at end of file diff --git a/livin/app/houses/review/[id]/page.tsx b/livin/app/houses/review/[id]/page.tsx index aa1e29a..4d7181d 100644 --- a/livin/app/houses/review/[id]/page.tsx +++ b/livin/app/houses/review/[id]/page.tsx @@ -12,7 +12,6 @@ import { deleteCommentApi, getCommentsApi, } from '@apis/comment'; -import axiosInstance from '@apis/axiosInstance'; interface ReviewDetail { id: number; @@ -59,18 +58,8 @@ export default function HouseDetailPage() { ); setReview(data); - // 댓글 데이터 로드 - const reviewId = Number(params.id); - console.log('[DEBUG] 하숙/자취 댓글 조회 시작 - reviewId:', reviewId, 'houseId:', houseId); - // comment.ts must not be changed; use direct axios call for house-scoped endpoint - let commentsData; - if (houseId) { - const res = await axiosInstance.get(`/house/${houseId}/review/${reviewId}/comment`); - commentsData = res.data; - } else { - commentsData = await getCommentsApi(reviewId); - } - console.log('[DEBUG] 하숙/자취 댓글 조회 응답:', commentsData); + // 댓글 데이터 로드 (houseId 없이 reviewId만 넘김) + const commentsData = await getCommentsApi(Number(params.id)); setComments(commentsData.comments); } catch (error) { console.error('Failed to fetch review detail:', error); @@ -143,14 +132,8 @@ export default function HouseDetailPage() { content: commentText, anonymous: isAnonymous, }); - // 댓글 목록 새로고침 - let commentsData; - if (houseId) { - const res = await axiosInstance.get(`/house/${houseId}/review/${reviewId}/comment`); - commentsData = res.data; - } else { - commentsData = await getCommentsApi(reviewId); - } + // 댓글 목록 새로고침 (houseId 없이 reviewId만 넘김) + const commentsData = await getCommentsApi(reviewId); setComments(commentsData.comments); setCommentText(''); } catch (error) { @@ -168,14 +151,8 @@ export default function HouseDetailPage() { try { const reviewId = Number(params.id); await deleteCommentApi(commentId); - // 댓글 목록 새로고침 - let commentsData; - if (houseId) { - const res = await axiosInstance.get(`/house/${houseId}/review/${reviewId}/comment`); - commentsData = res.data; - } else { - commentsData = await getCommentsApi(reviewId); - } + // 댓글 목록 새로고침 (houseId 없이 reviewId만 넘김) + const commentsData = await getCommentsApi(reviewId); setComments(commentsData.comments); } catch (error) { console.error('댓글 삭제 실패:', error);