Skip to content

Commit 8e38f31

Browse files
committed
2 parents 5fd9543 + 8378b1d commit 8e38f31

File tree

5 files changed

+74
-10
lines changed

5 files changed

+74
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: MAIN CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
Deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source code
14+
uses: actions/checkout@v3
15+
16+
- name: Install pnpm
17+
run: |
18+
npm install -g pnpm
19+
20+
- name: Get pnpm store path
21+
id: pnpm-cache-path
22+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
23+
24+
- name: Cache pnpm modules
25+
id: cache
26+
uses: actions/cache@v3
27+
with:
28+
path: ${{ env.STORE_PATH }}
29+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-pnpm-
32+
${{ runner.os }}-
33+
34+
- name: Install Dependencies
35+
run: |
36+
pnpm install --frozen-lockfile
37+
pnpm store prune
38+
39+
- name: Set up .env file
40+
run: |
41+
echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > .env.production
42+
echo "HTTPS=true" >> .env.production
43+
44+
- name: Build
45+
run: pnpm run build
46+
47+
- name: Configure AWS Credentials
48+
uses: aws-actions/configure-aws-credentials@v2
49+
with:
50+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
51+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
52+
aws-region: ${{ secrets.AWS_REGION }}
53+
54+
- name: Deploy to S3
55+
run: aws s3 sync ./dist s3://${{ secrets.AWS_BUCKET_NAME }} --delete
56+
57+
- name: Invalidate CloudFront Cache
58+
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*"

src/hooks/useServerSentEvents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const useServerSentEvents = () => {
7979

8080
sourceRef.current.onerror = () => {
8181
// 에러 발생시 해당 에러가 45초를 넘어서 발생한 에러인지, 401에러인지 판단할 수 있는게 없어서 그냥 에러 발생하면 reissue 넣는걸로 때움
82-
callReissue();
8382
closeSSE();
8483
recallCountRef.current += 1;
8584
console.log('SSE연결 에러 발생');
@@ -92,6 +91,7 @@ export const useServerSentEvents = () => {
9291
}
9392
};
9493
} catch (error) {
94+
callReissue();
9595
console.error(error);
9696
}
9797
};

src/main.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ queryClient.setDefaultOptions({
1515
});
1616

1717
createRoot(document.getElementById('root')!).render(
18-
// <StrictMode>
19-
<QueryClientProvider client={queryClient}>
20-
<BrowserRouter>
21-
<App />
22-
</BrowserRouter>
23-
</QueryClientProvider>,
24-
// </StrictMode>
18+
<StrictMode>
19+
<QueryClientProvider client={queryClient}>
20+
<BrowserRouter>
21+
<App />
22+
</BrowserRouter>
23+
</QueryClientProvider>
24+
</StrictMode>,
2525
);

src/pages/Auth/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ const AuthCallbackPage = () => {
7575
return;
7676
}
7777
navigate('/notFound');
78+
if (error === 'deleted_member') {
79+
alert('탈퇴한 회원입니다.');
80+
}
7881
return;
7982
}
8083

src/pages/LetterBoardDetail/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { twMerge } from 'tailwind-merge';
44
import {
55
getSharePostDetail,
66
SharePost,
7-
postSharePostLike,
87
getSharePostLikeCount,
8+
postSharePostLike,
99
} from '@/apis/share';
1010
import ReportModal from '@/components/ReportModal';
1111

1212
import Header from './components/Header';
1313
import Letter from './components/Letter';
14-
import { useParams } from 'react-router';
14+
import { useLocation, useParams } from 'react-router';
1515
import useAuthStore from '@/stores/authStore';
1616

1717
const LetterBoardDetailPage = () => {
@@ -20,6 +20,9 @@ const LetterBoardDetailPage = () => {
2020
const [isWriter, setIsWriter] = useState(false);
2121
const [postDetail, setPostDetail] = useState<SharePost>();
2222
const [activeReportModal, setActiveReportModal] = useState(false);
23+
const location = useLocation();
24+
const sharePostId: string = location.pathname.split('/')[3];
25+
// const isShareLetterPreview = location.state?.isShareLetterPreview || false;
2326

2427
const { id } = useParams();
2528

0 commit comments

Comments
 (0)