diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 3a421e6..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: MAIN CI - -on: - push: - branches: - - main - -jobs: - Deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Install pnpm - run: | - npm install -g pnpm - - - name: Get pnpm store path - id: pnpm-cache-path - run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV - - - name: Cache pnpm modules - id: cache - uses: actions/cache@v3 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - ${{ runner.os }}- - - - name: Install Dependencies - run: | - pnpm install --frozen-lockfile - pnpm store prune - - - name: Set up .env file - run: | - echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > .env.production - echo "HTTPS=true" >> .env.production - - - name: Build - run: pnpm run build - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Deploy to S3 - run: aws s3 sync ./dist s3://${{ secrets.AWS_BUCKET_NAME }} --delete - - - name: Invalidate CloudFront Cache - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*" diff --git a/src/apis/share.ts b/src/apis/share.ts index 37a3087..6018376 100644 --- a/src/apis/share.ts +++ b/src/apis/share.ts @@ -163,7 +163,6 @@ export const postSharePostLike = async (sharePostId: string) => { return response.data; } catch (error) { console.error('❌ 편지 좋아요 중 에러가 발생했습니다', error); - throw new Error('편지 좋아요 실패'); } }; @@ -175,6 +174,15 @@ export const getSharePostLikeCount = async (sharePostId: string) => { return response.data; } catch (error) { console.error('❌ 편지 좋아요 갯수 조회 중 에러가 발생했습니다', error); - throw new Error('편지 좋아요 갯수 조회 실패'); + } +}; + +export const deleteSharePost = async (sharePostId: string) => { + try { + const response = await client.delete(`/api/share-posts/${sharePostId}`); + if (!response) throw new Error('error while deleting post'); + return response; + } catch (error) { + console.error('❌ 편지 삭제 중 에러가 발생했습니다', error); } }; diff --git a/src/components/MenuButton.tsx b/src/components/MenuButton.tsx index 681e59a..d911338 100644 --- a/src/components/MenuButton.tsx +++ b/src/components/MenuButton.tsx @@ -16,44 +16,48 @@ export default function MenuButton() { setIsOpen(false)} > - setIsOpen(false)} /> + setIsOpen(false)} > - setIsOpen(false)} /> + setIsOpen(false)} > - setIsOpen(false)} /> +
setIsOpen((state) => !state)} > - setIsOpen((state) => !state)} /> +
diff --git a/src/main.tsx b/src/main.tsx index 4df6fa6..41bea78 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -15,11 +15,11 @@ queryClient.setDefaultOptions({ }); createRoot(document.getElementById('root')!).render( - - - - - - - , + // + + + + + , + // , ); diff --git a/src/pages/LetterBoardDetail/components/Header.tsx b/src/pages/LetterBoardDetail/components/Header.tsx index 26c306e..437ef61 100644 --- a/src/pages/LetterBoardDetail/components/Header.tsx +++ b/src/pages/LetterBoardDetail/components/Header.tsx @@ -14,6 +14,7 @@ interface HeaderProps { isWriter: boolean; onToggleLike: () => void; onOpenReportModal: () => void; + onDeleteLetter: () => void; isShareLetterPreview?: boolean; } @@ -23,10 +24,10 @@ const Header = ({ isWriter, onToggleLike, onOpenReportModal, + onDeleteLetter, isShareLetterPreview = false, }: HeaderProps) => { const navigate = useNavigate(); - return (
@@ -46,8 +47,7 @@ const Header = ({

{likeCount}

{isWriter ? ( - // TODO: 게시물 삭제 - + ) : ( )} - + {!isShareMode && } ); }; diff --git a/src/pages/RandomLetters/components/Matched.tsx b/src/pages/RandomLetters/components/Matched.tsx index 0bc3857..3e58736 100644 --- a/src/pages/RandomLetters/components/Matched.tsx +++ b/src/pages/RandomLetters/components/Matched.tsx @@ -5,6 +5,7 @@ import { deleteRandomLetterMatching } from '@/apis/randomLetter'; import ResultLetter from '@/components/ResultLetter'; import { formatNumber } from '@/utils/formatNumber'; import { timeFormatter } from '@/utils/timeFormatter'; +import useToastStore from '@/stores/toastStore'; export default function Matched({ matchedLetter, @@ -18,6 +19,7 @@ export default function Matched({ setOpenSelectedDetailModal: React.Dispatch>; }) { const navigate = useNavigate(); + const setToastActive = useToastStore((state) => state.setToastActive); const [isDisabled, setIsDisabled] = useState(false); @@ -43,7 +45,7 @@ export default function Matched({ const handleDeleteRandomLetterMatching = async () => { const res = await deleteRandomLetterMatching(); if (res?.status === 200) { - alert('매칭이 취소되었습니다.'); + setToastActive({ title: '매칭이 취소되었습니다.', toastType: 'Success' }); navigate(-1); } }; diff --git a/src/pages/RandomLetters/components/MatchedLetter.tsx b/src/pages/RandomLetters/components/MatchedLetter.tsx index 3ff4907..e54546a 100644 --- a/src/pages/RandomLetters/components/MatchedLetter.tsx +++ b/src/pages/RandomLetters/components/MatchedLetter.tsx @@ -14,7 +14,7 @@ const MatchedLetter = ({ matchedLetter }: { matchedLetter: MatchedLetter }) => { <>
diff --git a/src/pages/RandomLetters/index.tsx b/src/pages/RandomLetters/index.tsx index c1b12d9..d71c3d1 100644 --- a/src/pages/RandomLetters/index.tsx +++ b/src/pages/RandomLetters/index.tsx @@ -75,6 +75,14 @@ const RandomLettersPage = () => { }, []); return ( <> + {openSelectModal && ( + + )} {openSelectedDetailModal ? ( ) : ( @@ -103,15 +111,6 @@ const RandomLettersPage = () => { setOpenSelectedDetailModal={setOpenSelectedDetailModal} /> )} - - {openSelectModal && ( - - )}
diff --git a/src/pages/RollingPaper/index.tsx b/src/pages/RollingPaper/index.tsx index 28fc0f6..06069c1 100644 --- a/src/pages/RollingPaper/index.tsx +++ b/src/pages/RollingPaper/index.tsx @@ -129,8 +129,8 @@ const RollingPaperPage = () => { )} + - );