Skip to content

Commit eed9393

Browse files
authored
[Feature] FE API 요청 주소를 BE 서버 주소로 변경한다. (#364)
* feat: FE API 주소 추가 * feat: BE CORS URL 추가 * feat: literal 내부에서 import 해오도록 수정 * fix: CORS 하나만 허용하도록 수정 * fix: 누락된 literal API 수정 * fix: Sentry 관련 로직들 주석 해제 * feat: Workflow FE 빌드 작업에 환경변수 추가 * feat: BE 서버로 전송
1 parent 7e52ccc commit eed9393

File tree

16 files changed

+24
-17
lines changed

16 files changed

+24
-17
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,8 @@ jobs:
6666
push: false
6767
build-args: |
6868
VITE_API_URL=${{ secrets.VITE_API_URL }}
69+
VITE_SOCKET_URL: ${{ secrets.VITE_SOCKET_URL }}
70+
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
71+
VITE_ENABLE_SENTRY: ${{ secrets.VITE_ENABLE_SENTRY }}
6972
tags: |
7073
${{ env.REGISTRY }}/${{ steps.image_names.outputs.frontend_image }}:pr-${{ github.event.pull_request.number }}

.github/workflows/deploy-dev.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
push: true
5353
build-args: |
5454
VITE_API_URL=${{ secrets.VITE_API_URL }}
55+
VITE_SOCKET_URL: ${{ secrets.VITE_SOCKET_URL }}
56+
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
57+
VITE_ENABLE_SENTRY: ${{ secrets.VITE_ENABLE_SENTRY }}
5558
tags: |
5659
${{ env.REGISTRY }}/${{ steps.image_names.outputs.frontend_image }}:latest
5760
${{ env.REGISTRY }}/${{ steps.image_names.outputs.frontend_image }}:${{ github.sha }}

.github/workflows/deploy-prod.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ jobs:
8989
push: true
9090
build-args: |
9191
VITE_API_URL=${{ secrets.VITE_API_URL }}
92+
VITE_SOCKET_URL: ${{ secrets.VITE_SOCKET_URL }}
93+
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
94+
VITE_ENABLE_SENTRY: ${{ secrets.VITE_ENABLE_SENTRY }}
9295
tags: |
9396
${{ env.REGISTRY }}/${{ steps.image_names.outputs.frontend_image }}:latest
9497
${{ env.REGISTRY }}/${{ steps.image_names.outputs.frontend_image }}:${{ steps.set_version.outputs.version_tag }}

frontend/src/commons/apis/getBattleInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function isBattleInfo(data: unknown): data is BattleInfo {
3131

3232
const getBattleInfo = async (id: string) => {
3333
try {
34-
const response = await fetch(`/api/battles/${id}/join`, {
34+
const response = await fetch(`${import.meta.env.VITE_API_URL}/api/battles/${id}/join`, {
3535
method: 'POST',
3636
headers: {
3737
'Content-Type': 'application/json'

frontend/src/commons/apis/getOAuthUser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function isOAuthUserResponse(data: unknown): data is OAuthUserResponse {
3636
}
3737

3838
const getOAuthUser = async (): Promise<AuthUser> => {
39-
const response = await fetch('/api/auth/me', {
39+
const response = await fetch(`${import.meta.env.VITE_API_URL}/api/auth/me`, {
4040
method: 'GET',
4141
credentials: 'include'
4242
});

frontend/src/commons/apis/postGuestLogin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function isGuestLoginResponse(data: unknown): data is GuestLoginResponse {
1515
}
1616

1717
const fetchPostGuestLogin = async (battleId: string) => {
18-
const response = await fetch(`/api/auth/guest/${battleId}`, {
18+
const response = await fetch(`${import.meta.env.VITE_API_URL}/api/auth/guest/${battleId}`, {
1919
method: 'POST',
2020
headers: {
2121
'Content-Type': 'application/json'

frontend/src/commons/apis/postLogout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function isLogoutResponse(data: unknown): data is LogoutResponse {
1212
}
1313

1414
const logout = async () => {
15-
const response = await fetch('/api/auth/logout', {
15+
const response = await fetch(`${import.meta.env.VITE_API_URL}/api/auth/logout`, {
1616
method: 'POST',
1717
credentials: 'include'
1818
});

frontend/src/commons/apis/postRefreshToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const refreshToken = async (): Promise<void> => {
2-
const response = await fetch('/api/auth/refresh', {
2+
const response = await fetch(`${import.meta.env.VITE_API_URL}/api/auth/refresh`, {
33
method: 'POST',
44
credentials: 'include'
55
});

frontend/src/pages/battleCreatePage/api/createBattle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { CreateBattleRequest, CreateBattleResponse } from './types';
22
import { isCreateBattleResponse } from './types';
33

44
const createBattle = async (battleData: CreateBattleRequest): Promise<CreateBattleResponse> => {
5-
const response = await fetch('/api/battles', {
5+
const response = await fetch(`${import.meta.env.VITE_API_URL}/api/battles`, {
66
method: 'POST',
77
headers: {
88
'Content-Type': 'application/json'

frontend/src/pages/battlePage/hooks/useBattleSocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function useBattleSocket() {
3131

3232
if (!userId || !battleId) return;
3333

34-
const newSocket = io(import.meta.env.VITE_API_URL, {
34+
const newSocket = io(import.meta.env.VITE_SOCKET_URL, {
3535
transports: ['websocket'],
3636
auth: { userId },
3737
reconnection: true,

0 commit comments

Comments
 (0)